Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB.net and Excel COM exe
I have a cunning plan to open an Excel workbook and call a macro insid
that will open, then manipulate another .xls file on the hard driv before saving it in a different location. The .xls file is opened with a .exe file, which opens the workbook an calls the macro in the background. For clarity, the file is called 'macroOfDeathFile.xls', with the macr being called 'macroOfDeath': <VB CODE Module fquicken Sub Main() Dim xlApp As Excel.Application xlApp = CreateObject("Excel.Application") xlApp.Application.DisplayAlerts = False Dim wb As Excel.Workbook wb = xlApp.Workbooks.Open("C:\macroOfDeathFile.xls") xlApp.Visible = True xlApp.Run("macroOfDeath") xlApp.Quit() xlApp = Nothing wb = Nothing End Sub End Module </VBCODE This will execute, but I do not want Excel to be visible. Some woul say "change xlApp.Visible to false": but if it is set to true, it executes the macro and saves a file in seconds, while if it is set to 'xlApp.Visible = false' then it take about 1 minute. I am hoping that someone amongst this community works in VB and Exce who can tell me what Microsoft are playing at here, and perhaps sugges a possible workaround. Cheers, .tehw -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB.net and Excel COM exe
*Try* setting
xlApp.ScreenUpdating = False before running the macro. -- Regards, Juan Pablo González "tehwa " wrote in message ... I have a cunning plan to open an Excel workbook and call a macro inside that will open, then manipulate another .xls file on the hard drive before saving it in a different location. The .xls file is opened with a .exe file, which opens the workbook and calls the macro in the background. For clarity, the file is called 'macroOfDeathFile.xls', with the macro being called 'macroOfDeath': <VB CODE Module fquicken Sub Main() Dim xlApp As Excel.Application xlApp = CreateObject("Excel.Application") xlApp.Application.DisplayAlerts = False Dim wb As Excel.Workbook wb = xlApp.Workbooks.Open("C:\macroOfDeathFile.xls") xlApp.Visible = True xlApp.Run("macroOfDeath") xlApp.Quit() xlApp = Nothing wb = Nothing End Sub End Module </VBCODE This will execute, but I do not want Excel to be visible. Some would say "change xlApp.Visible to false": but if it is set to true, it executes the macro and saves a file in 3 seconds, while if it is set to 'xlApp.Visible = false' then it takes about 1 minute. I am hoping that someone amongst this community works in VB and Excel who can tell me what Microsoft are playing at here, and perhaps suggest a possible workaround. Cheers, tehwa --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|