EdPianoMan
New Member
- Joined
- May 27, 2011
- Messages
- 1
I want to perform the equivalent of MsgBox in my VB.NET application which uses Excel programmatically.
I'm writing an application in VB.NET. I create an instance of the Excel application object and then create a worksheet. The code populates
the worksheet with data and then attempts to write the worksheet to an Excel file. If the user has an existing Excel file open with the same file name as the one one the code is attempting to create\write Excel throws an exception.
To prevent the exception from occurring I wrote a module to detect if there is an Excel file open with the same file name as the one I want to write. If there is a file open then I want to ask the user to close the Excel file and click OK to continue operation so my VB.NET app can write the worksheet to the file.
I'd like to ask the user to close the open file using an equivalent of MsgBox dialog. However, the only dialog box I can find in the Excel application object is InputBox (I know there is the Dialogs collection but none of those dialogs appear to provide the MsgBox functionality. Also, I can't find much documentation on these dialog boxes).
At the moment I've coded my app to use InputBox. It's not the best solution. I would like to use something like MsgBox. Anyone have suggestions?
Ed
I'm writing an application in VB.NET. I create an instance of the Excel application object and then create a worksheet. The code populates
the worksheet with data and then attempts to write the worksheet to an Excel file. If the user has an existing Excel file open with the same file name as the one one the code is attempting to create\write Excel throws an exception.
To prevent the exception from occurring I wrote a module to detect if there is an Excel file open with the same file name as the one I want to write. If there is a file open then I want to ask the user to close the Excel file and click OK to continue operation so my VB.NET app can write the worksheet to the file.
I'd like to ask the user to close the open file using an equivalent of MsgBox dialog. However, the only dialog box I can find in the Excel application object is InputBox (I know there is the Dialogs collection but none of those dialogs appear to provide the MsgBox functionality. Also, I can't find much documentation on these dialog boxes).
At the moment I've coded my app to use InputBox. It's not the best solution. I would like to use something like MsgBox. Anyone have suggestions?
Ed