Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
VBA for Excel question (VB6)
The following code is a VB6 Standard EXE. I create an Excel app using
OLE Automation. I only want One Excel app to be opened at one time.
If the Excel app is already opened, I reuse it to update the cell value.
If the user close the Excel and re-click the Command1 button in the VB app, the app should create a fresh excel app. However, the code below show runtime error. How to check whether the user have close the Excel app created by VB? Please advise... Thanks.
P/S: Message wrongly posted to Basic messagebox instead of VBA.
------------------- The Code ----------------
Dim myApp As Excel.Application
Private Sub Command1_Click()
If myApp Is Nothing Then
Set myApp = New Excel.Application
myApp.Visible = True
myApp.Cells(1, 1).Value = "Hello"
0 · ·