Thread: Run Macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Steph[_3_] Steph[_3_] is offline
external usenet poster
 
Posts: 312
Default Run Macro

Hi Jim,
I tried your suggestion, but got an ActiveX component can't create object
error. Any ideas?


"Jim Thomlinson" wrote in message
...
Dim appXL As Excel.Application
Dim wbk As Workbook

Set appXL = CreateObject("Excel.Application.9")
'appXL.Visible = True
Set wbk = appXL.Workbooks.Open(m_strPath & m_strFileName)
'wbk.RunAutoMacros xlAutoOpen
'ThisWorkbook.Close SaveChanges:=False
set appXL = Nothing

You just need to specify the path and file name...

"Steph" wrote:

Hi. I understand I need to open a woekbook in order to run the code

within
it (can't run code from a closed workbook). My question is this - Is

there
a way to open the workbook in such a way that the user doesn't see it

being
opened? I have Application.ScreenUpdating=False, but you still see the
workbook open, then close.

So I guess I'm asking if I can open a workbook in the background without

it
automatically being activated? Thanks!