View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
rmkbrj rmkbrj is offline
external usenet poster
 
Posts: 7
Default Can I invoke excel automatically from .bat or other means so t

Thanks, I'll Try that.

"keepITcool" wrote:


Try creating a file with VBS extention.
This VBScript file is basically a latebound VBA file
and coding is almost similar to VBA.

Please note that many administrators will disable VBS files from running
on their networks.



'Code for OpenBook.vbs
Dim xlApp
Dim xlWkb
Const cEXIT = True

Set xlApp = CreateObject("excel.application")
Set xlWkb = xlApp.Workbooks.Open("c:\book.xls")
xlWkb.RunAutoMacros 1 'xlautoopen
xlApp.Run "book.xls!MacroA"
xlApp.Run "book.xls!MacroB"

'now either make Excel visible or close it
If cEXIT Then
xlWkb.Close 0
xlApp.Quit
Set xlWkb = Nothing
Set xlApp = Nothing
Else
xlApp.Visible = True
End If

hope this gives you a leg up. :)





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


rmkbrj wrote :

Well,

If I wanted to open a specific spreadsheet and execute a macro
without intervention what else might I do?

"Jim Thomlinson" wrote:

Yup... Place this line in a batch file

"C:\Program Files\Microsoft Office\Office\excel.exe"

You have to assume a standard install of excel though...

HTH

"rmkbrj" wrote:

I would like to automate updating of a number of excel
spreadsheets. Is there any way to invoke excel without opening
excel or a excel spreadsheet.