#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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!





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 06:55 PM.

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"