I want to use GetObject to edit an Excel file, and I don't want it to be visible. But if I don't include:
objExcel.Application.Visible = True
objExcel.Parent.Windows(1).Visible = True
when I open up test.xls, Excel opens but does not load the workbook. Please Help, Thanks.
Sub EditExcel()
Dim appExcel As Excel.Application, objExcel As Object
Set appExcel = CreateObject("Excel.Application"
Set objExcel = GetObject("c:\Excel Files\test.xls"
objExcel.Application.Visible = True
objExcel.Parent.Windows(1).Visible = True
For Each ws In objExcel.Worksheets
' Edit excel file here.
Next ws
objExcel.Save
appExcel.Quit
Set appExcel = Nothing
Set objExcel = Nothing
End Sub
objExcel.Application.Visible = True
objExcel.Parent.Windows(1).Visible = True
when I open up test.xls, Excel opens but does not load the workbook. Please Help, Thanks.
Sub EditExcel()
Dim appExcel As Excel.Application, objExcel As Object
Set appExcel = CreateObject("Excel.Application"
Set objExcel = GetObject("c:\Excel Files\test.xls"
objExcel.Application.Visible = True
objExcel.Parent.Windows(1).Visible = True
For Each ws In objExcel.Worksheets
' Edit excel file here.
Next ws
objExcel.Save
appExcel.Quit
Set appExcel = Nothing
Set objExcel = Nothing
End Sub