Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"