Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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
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
Save as Command Line SoDakRah Excel Discussion (Misc queries) 1 July 29th 08 06:12 PM
Command line switches - possible Duke Carey Excel Discussion (Misc queries) 0 August 17th 07 01:44 AM
Command Line Export fjurek Excel Discussion (Misc queries) 6 April 23rd 07 09:08 PM
macros from command line Cyberwolf Excel Discussion (Misc queries) 3 July 19th 05 05:35 PM
Q: command line in OE JIM.H. Excel Discussion (Misc queries) 0 May 30th 05 10:48 PM


All times are GMT +1. The time now is 05:33 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"