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 |