Error with MessageBox in Excel

Mar 11, 2013 at 5:23 PM
Hi,

I am trying to display a message box within Excel when I try and connect to an Access database using Excel DNA. I am trying to write a method that will pull data from the database and need an error message to show if the connection fails. When I use the MessageBox.Show command I get the "The name 'MessageBox' does not exist in the current context" error. Is there any particular namespace I should be using or is there another way of referencing message boxes within Excel 2010 through Excel DNA?
Coordinator
Mar 13, 2013 at 11:40 AM
Hi Michael,

I guess you are looking for the System.Windows.Forms.MessageBox class. You need to add a reference to the System.Windows.Forms assembly in your project, and add a using/Imports declaration for the namespace System.Windows.Forms.

-Govert
Mar 13, 2013 at 1:05 PM
Great thanks Govert, worked perfectly