Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro
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! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro
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! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro
Depends what version of excel you are running... In Excel click help and
About. You will see a version number like (9.0._____). The 9 is your version number. change that in your code... Excel.Application.9 "Steph" wrote: 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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
need help to update macro to office 2007 macro enabled workbook | Excel Discussion (Misc queries) | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |