PC Review


Reply
Thread Tools Rate Thread

Can I pass arguments to my formatted empty spreadsheet file?

 
 
Paul H
Guest
Posts: n/a
 
      24th Jul 2009
Now that I have my macro running (to import a .CSV file) when I push the
button I added to the tool bar, I need a way to pass the file to be imported
into my formatted empty spreadsheet, and run the macro. Is this possible?
Can I pass arguments, maybe from a .BAT file, to eliminate the user from
being involved except to start some process, this being one of many steps to
run at night. Excel 2003 and 2007. I cannot find anything appropriate
about arguments in my very good Excel 2007 book by Walkenbach. TIA, Paul

 
Reply With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      24th Jul 2009
Please search this group and read the thread :

subject: Schedule a macro on a specific time

"Paul H" <(E-Mail Removed)> wrote in message
news:B7A7BDFC-02DE-47EA-AA31-(E-Mail Removed)...
> Now that I have my macro running (to import a .CSV file) when I push the
> button I added to the tool bar, I need a way to pass the file to be
> imported into my formatted empty spreadsheet, and run the macro. Is this
> possible? Can I pass arguments, maybe from a .BAT file, to eliminate the
> user from being involved except to start some process, this being one of
> many steps to run at night. Excel 2003 and 2007. I cannot find anything
> appropriate about arguments in my very good Excel 2007 book by Walkenbach.
> TIA, Paul


 
Reply With Quote
 
Paul H
Guest
Posts: n/a
 
      25th Jul 2009

I searched Google and found the reference. It required me to know VB, which
I do not. I am hoping to find an example of a .Bat file or some similar
method to pass argument(s) and run a specific excel spreadsheet, using a
built-in macro, which I will have have recorded. I suppose I could rename
the current day's .CVS file to the name the macro has built-in, then rename
the resultant .XLS file to today's date as a subsequent step, so I'd just
need to start the spreadsheet as one of many steps in the night job.

"Patrick Molloy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Please search this group and read the thread :
>
> subject: Schedule a macro on a specific time
>
> "Paul H" <(E-Mail Removed)> wrote in message
> news:B7A7BDFC-02DE-47EA-AA31-(E-Mail Removed)...
>> Now that I have my macro running (to import a .CSV file) when I push the
>> button I added to the tool bar, I need a way to pass the file to be
>> imported into my formatted empty spreadsheet, and run the macro. Is this
>> possible? Can I pass arguments, maybe from a .BAT file, to eliminate the
>> user from being involved except to start some process, this being one of
>> many steps to run at night. Excel 2003 and 2007. I cannot find anything
>> appropriate about arguments in my very good Excel 2007 book by
>> Walkenbach. TIA, Paul

>


 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      25th Jul 2009
if you use the workbook OPEN event to fire the macro, then you can use
Windows Task Manager to run the spreadsheet automatically

open the spreadsheet
go to the IDE (development environment) by pressing ALT+F11
go to the Project Explorer (Ctrl+R)
lookfor VBA(project(your workbook), then right click on ThisWorkbook and
select View Code
where you see (General) change to Workbook (its a dropdown)

you will see this:

Private Sub Workbook_Open()

End Sub

now add the name of your macro......

for example:
Private Sub Workbook_Open()
macro1
End Sub


whenever the workbook opens, the Open event fires and this in turns kicks
off your macro.

save the workbook

Open Task Manager on the PC that will run the spreadsheet .... setting up a
new task should be self explanatory. the program to run is NOT excel.exe but
it is the full name of your workbook


"Paul H" <(E-Mail Removed)> wrote in message
news:3F0DFD74-968A-4723-A9E4-(E-Mail Removed)...
>
> I searched Google and found the reference. It required me to know VB,
> which I do not. I am hoping to find an example of a .Bat file or some
> similar method to pass argument(s) and run a specific excel spreadsheet,
> using a built-in macro, which I will have have recorded. I suppose I
> could rename the current day's .CVS file to the name the macro has
> built-in, then rename the resultant .XLS file to today's date as a
> subsequent step, so I'd just need to start the spreadsheet as one of many
> steps in the night job.
>
> "Patrick Molloy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Please search this group and read the thread :
>>
>> subject: Schedule a macro on a specific time
>>
>> "Paul H" <(E-Mail Removed)> wrote in message
>> news:B7A7BDFC-02DE-47EA-AA31-(E-Mail Removed)...
>>> Now that I have my macro running (to import a .CSV file) when I push the
>>> button I added to the tool bar, I need a way to pass the file to be
>>> imported into my formatted empty spreadsheet, and run the macro. Is
>>> this possible? Can I pass arguments, maybe from a .BAT file, to
>>> eliminate the user from being involved except to start some process,
>>> this being one of many steps to run at night. Excel 2003 and 2007. I
>>> cannot find anything appropriate about arguments in my very good Excel
>>> 2007 book by Walkenbach. TIA, Paul

>>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I pass arguments to my formatted empty spreadsheet file? Paul H Microsoft Excel Misc 3 25th Jul 2009 07:34 PM
pass arguments to macro of excel file from command line poli Microsoft Excel Discussion 0 3rd Feb 2006 10:14 AM
Re: Pass Arguments Dan Artuso Microsoft Access VBA Modules 0 9th Sep 2004 11:11 PM
Is it possible to pass arguments to excel file ? (from command line) tal Microsoft Excel Worksheet Functions 1 8th Apr 2004 06:14 PM
Pass file name from Spreadsheet Range Bruce Roberson Microsoft Excel Programming 5 16th Aug 2003 12:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:24 PM.