I am creating a number of excel workbooks (xlsm) using Access vba code - using Office 2007. I want to hide excel during all the processing.
I am using xlApp.visible = false (where xlApp is defined as excel.application. This works until I use the "copy after" function to make a copy of a worksheet. This makes the excel workbook visible - which I am trying to avoid.
I believe my approach was working in Office 2003. Anyone know how to address this? Here is the code that has the problem.
I am using xlApp.visible = false (where xlApp is defined as excel.application. This works until I use the "copy after" function to make a copy of a worksheet. This makes the excel workbook visible - which I am trying to avoid.
I believe my approach was working in Office 2003. Anyone know how to address this? Here is the code that has the problem.
Code:
Private Sub cmdTest_Click()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim sDestinationFile As String
sDestinationFile = "c:\rad\test.xlsm"
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
Set xlWB = xlApp.Workbooks.Open(sDestinationFile)
[COLOR=red]xlWB.Sheets("Facility").Copy After:=xlWB.Sheets("Facility")[/color]
xlApp.Visible = False
End Sub