(I started this thread a few days ago, but now have more info regarding this issue).
I create a number of excel workbooks that contain macros(xlsm) using Access vba code. I am running Office 2007. I want to hide excel during all the processing. The approach shown below worked in Office 2003.
I am using the command xlApp.visible = false (where xlApp is defined as excel.application) to hide Excel and the "copy after" function to make a copy of a "template" worksheet to another. This code works fine as long as there are no ActiveX objects (check boxes, buttons, combo box) on the "source" worksheet.
When the "source" worksheet has one of these ActiveX objects, Excel remains hidden until I use the "copy after" function to make a copy of a worksheet (code sample below). When this command is executed, the Excel workbook becomes visible for a brief time (less than a second) and then it is hidden again. I need to avoid this since it interrupts the user during this processing.
Anyone have any thoughts on how to handle this? Can you replicate this behavior? Here is the code.
I create a number of excel workbooks that contain macros(xlsm) using Access vba code. I am running Office 2007. I want to hide excel during all the processing. The approach shown below worked in Office 2003.
I am using the command xlApp.visible = false (where xlApp is defined as excel.application) to hide Excel and the "copy after" function to make a copy of a "template" worksheet to another. This code works fine as long as there are no ActiveX objects (check boxes, buttons, combo box) on the "source" worksheet.
When the "source" worksheet has one of these ActiveX objects, Excel remains hidden until I use the "copy after" function to make a copy of a worksheet (code sample below). When this command is executed, the Excel workbook becomes visible for a brief time (less than a second) and then it is hidden again. I need to avoid this since it interrupts the user during this processing.
Anyone have any thoughts on how to handle this? Can you replicate this behavior? Here is the code.
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]
xlWB.ActiveSheet.Name = "newName"
xlWB.Save
xlWB.Close
xlApp.Quit
Set xlWB = Nothing
Set xlApp = Nothing
End Sub