Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
DOS Command Line
My batch file opens the following
"C:\Program Files\Microsoft Office\Office10 \excel.exe" "G:\Customers\Vsource\Clarify.xls" How do I then run the macro "Sheet1.RefreshData" ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
DOS Command Line
Put the macro in the 'Workbook Open' sub procedure
-----Original Message----- My batch file opens the following "C:\Program Files\Microsoft Office\Office10 \excel.exe" "G:\Customers\Vsource\Clarify.xls" How do I then run the macro "Sheet1.RefreshData" ? . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
DOS Command Line
Open workbook Clarify.xls and open the VB window (right
click on a sheet tab and select "view code"). In the VB Project Explorer window, under Clarify.xls, expand "Microsoft Excel Objects" and double click on "This workbook". Click the drop-down list in the top left hand corner of the editor window (should read (General) by default) and select "Workbook". You will see the following appear in the edit area: Private Sub Workbook_Open() End Sub Whatever code you insert between these lines will be automatically executed everytime you open the workbook. Nikos Y. -----Original Message----- My batch file opens the following "C:\Program Files\Microsoft Office\Office10 \excel.exe" "G:\Customers\Vsource\Clarify.xls" How do I then run the macro "Sheet1.RefreshData" ? . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
DOS Command Line
Hi Chris,
From the batch file? You can't unless you rename the macro Auto_Open() in a general module or Workbook_Open() in the ThisWorkBook module. (or call Sheet1.RefreshData from either) -- John johnf202 at hotmail dot com "Chris" wrote in message ... My batch file opens the following "C:\Program Files\Microsoft Office\Office10 \excel.exe" "G:\Customers\Vsource\Clarify.xls" How do I then run the macro "Sheet1.RefreshData" ? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
DOS Command Line
Just to expand on some of the useful suggestions already provided:
in G:\Customers\Vsource\Clarify.xls, in the workbook_open, you can call your macro - you don't have to put the code there. Private Sub Workbook_Open() ThisWorkbook.Sheet1.RefreshData End Sub Make sure RefreshData has been declared Public. It might be advisable to move it to a general module rather than have it in a sheet module. Sheet modules should be used primarily for event related code. -- Regards, Tom Ogilvy "Chris" wrote in message ... My batch file opens the following "C:\Program Files\Microsoft Office\Office10 \excel.exe" "G:\Customers\Vsource\Clarify.xls" How do I then run the macro "Sheet1.RefreshData" ? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
DOS Command Line
Put a workbook_open event macro in the ThisWorkbook module.
Right click on the small excel logo square to the left of FILE to insert this Private Sub Workbook_Open() your code end sub "Chris" wrote in message ... My batch file opens the following "C:\Program Files\Microsoft Office\Office10 \excel.exe" "G:\Customers\Vsource\Clarify.xls" How do I then run the macro "Sheet1.RefreshData" ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Save as Command Line | Excel Discussion (Misc queries) | |||
Command line switches - possible | Excel Discussion (Misc queries) | |||
Command Line Export | Excel Discussion (Misc queries) | |||
macros from command line | Excel Discussion (Misc queries) | |||
Q: command line in OE | Excel Discussion (Misc queries) |