Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Command line switches.

Hello,

We receive a rather poorly formatted csv file from our courier company to
serve as the digital copy of our monthly bill. I wanted to import this data
into Access 2003 so that it is easier for users to search and read the data.
I have created an Excel 2003 workbook that is to be used as an interface
file for Access 2003. I have created a macro that pulls the data in to the
spreadsheet, deletes what shouldn't be there, formats the rest, adds some
column headers, and saves it file to a new file. In Access 2003 I have then
written a script that is triggered by a button to pull the data into a table
and do some other bits. I was wondering if it would be possible to lauch
Excel opening a scpecified file and running a specified macro. If so, would
it be best done in VBA or are there command-line switches for this? I
figured that if the command-line switches were out there then I could write
a quick bacth file that could be fired from Access 2003 before it imports
the data.

Is there a better way to automate Excel?

TIA,

Jarryd


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Command line switches.

You can't run a macro from the command line. You could write a
procedure called Auto_Open that will be executed when the file is
opened.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jarryd" wrote in message
...
Hello,

We receive a rather poorly formatted csv file from our courier
company to serve as the digital copy of our monthly bill. I
wanted to import this data into Access 2003 so that it is
easier for users to search and read the data. I have created an
Excel 2003 workbook that is to be used as an interface file for
Access 2003. I have created a macro that pulls the data in to
the spreadsheet, deletes what shouldn't be there, formats the
rest, adds some column headers, and saves it file to a new
file. In Access 2003 I have then written a script that is
triggered by a button to pull the data into a table and do some
other bits. I was wondering if it would be possible to lauch
Excel opening a scpecified file and running a specified macro.
If so, would it be best done in VBA or are there command-line
switches for this? I figured that if the command-line switches
were out there then I could write a quick bacth file that could
be fired from Access 2003 before it imports the data.

Is there a better way to automate Excel?

TIA,

Jarryd



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Command line switches.

Easily done once you overcome Excel's lack of command line switches using
Windows Script Host (WSH).

' Filename: excel.vbs
' Overcomes Excel inability to run macros from the command line
' Usage: [CScript | WScript] excel.vbs macro(s)
'
'open excel
Dim macro
Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
xlapp.visible = true
xlapp.workbooks.add
xlapp.workbooks.open "C:\Program Files\Microsoft
Office\Office\Xlstart\personal.xls"
'
'now run macro
If wscript.arguments.count = 0 Then
'do nothing
Else
macro = "Personal.xls!" & WScript.Arguments.item(0)
xlapp.run macro
End If



"Jarryd" wrote in message
...
Hello,

We receive a rather poorly formatted csv file from our courier company to
serve as the digital copy of our monthly bill. I wanted to import this

data
into Access 2003 so that it is easier for users to search and read the

data.
I have created an Excel 2003 workbook that is to be used as an interface
file for Access 2003. I have created a macro that pulls the data in to

the
spreadsheet, deletes what shouldn't be there, formats the rest, adds some
column headers, and saves it file to a new file. In Access 2003 I have

then
written a script that is triggered by a button to pull the data into a

table
and do some other bits. I was wondering if it would be possible to lauch
Excel opening a scpecified file and running a specified macro. If so,

would
it be best done in VBA or are there command-line switches for this? I
figured that if the command-line switches were out there then I could

write
a quick bacth file that could be fired from Access 2003 before it imports
the data.

Is there a better way to automate Excel?

TIA,

Jarryd




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Command line switches.

Hello,

I think I have managed to sort something out. I used Sub Workbook_Open.
And I have managed to get it to open the xls file using a batch command.
The only thing I can't do is get Access to wait for the batch to finish
before continuing with the rest of the procedure.

But I suppose that is a question for another forum.

Cheers,

Jarryd
"Jarryd" wrote in message
...
Hello,

We receive a rather poorly formatted csv file from our courier company to
serve as the digital copy of our monthly bill. I wanted to import this
data into Access 2003 so that it is easier for users to search and read
the data. I have created an Excel 2003 workbook that is to be used as an
interface file for Access 2003. I have created a macro that pulls the
data in to the spreadsheet, deletes what shouldn't be there, formats the
rest, adds some column headers, and saves it file to a new file. In
Access 2003 I have then written a script that is triggered by a button to
pull the data into a table and do some other bits. I was wondering if it
would be possible to lauch Excel opening a scpecified file and running a
specified macro. If so, would it be best done in VBA or are there
command-line switches for this? I figured that if the command-line
switches were out there then I could write a quick bacth file that could
be fired from Access 2003 before it imports the data.

Is there a better way to automate Excel?

TIA,

Jarryd



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
command line options/switches to print excel file Stranger[_2_] Excel Discussion (Misc queries) 1 March 17th 09 01:04 PM
Command-line switches TJ Dowling Excel Discussion (Misc queries) 2 February 8th 08 04:00 PM
Command line switches - possible T1 Red Alarm Excel Discussion (Misc queries) 2 August 19th 07 08:54 AM
Command line switches - possible Niniel Excel Discussion (Misc queries) 0 August 17th 07 01:53 AM
Command line switches - possible Duke Carey Excel Discussion (Misc queries) 0 August 17th 07 01:44 AM


All times are GMT +1. The time now is 05:43 AM.

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"