Fritz Paul
asked on
Second call to open spreadsheet fro Access fails.
I use the VBA below to open an Excel workbook.
It opens and I close it again manually. The Excel window also closes.
If I try the process again, It does not open.
If I look on windows taskmanager, I see there is an Excel instance under processes. If I close that, the VBA works again one time.
Advice please.
My code is:
It opens and I close it again manually. The Excel window also closes.
If I try the process again, It does not open.
If I look on windows taskmanager, I see there is an Excel instance under processes. If I close that, the VBA works again one time.
Advice please.
My code is:
Private Sub cmdOpenExcelWorkbook_Click()
' Open Excel Workbook
Dim excelApp As Excel.Application
Dim wb As Excel.Workbook
Dim WorkbookToOpen As String
WorkbookToOpen = Me.txtOrigATD 'A textbox on my form
Set excelApp = CreateObject("Excel.Application")
Set wb = Excel.Workbooks.Open(WorkbookToOpen)
excelApp.Visible = True
' wb.ActiveSheet.Range("d1").Value = 100 'Passes a value to a cell on the spreadsheet.
Set excelApp = Nothing
Set wb = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
glad I could help.
ASKER