LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Passing parms to a VBS file or a macro when executed?

I have a REXX program that runs and now outputs different TXT files depending
on a Race Track. At the end of the REXX is run the following VBS that opens
Excel. I want to pass the VBS a variable filename.
In REXX I would call RaceBetting.vbs filename

How can I set up the VBS to accept the parm when run? And then how can I
then pass this to the macro within Excel (below)
[RaceBetting.vbs]
--------------
Dim XLApp
Dim XLWkb
Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = true
XLApp.Workbooks.Open "RaceBetting.xls"
XLApp.ActiveWorkbook.RunAutoMacros 1
----------------

In my macro I have the following code.
Note filename was hardcoded below, I believe I have the syntax correct
except on how to accept the passed-filename parm from the VBS file above.
----------------
Sub ImportRaceProgramData()
'
Dim file_name As Variant
Dim passed-filename As Variant (added)
Worksheets("ProgramDataInput").Range("A3:H242").Cl earContents
file_name = ThisWorkbook.Path & "\Cut-And-Paste-Into-XLS.txt" with
(replaced)
file_name = ThisWorkbook.Path & "\" & passed-filename with
Worksheets("ProgramDataInput").QueryTables.Add(Con nection:= _
"TEXT;" & file_name _
more
 
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 get executed twice Anand Nichkaode Excel Discussion (Misc queries) 3 September 24th 08 01:25 PM
No file when Save As is executed D.Parker Excel Programming 7 April 2nd 05 12:46 AM
No file when Save As is executed Dave Peterson[_5_] Excel Programming 1 March 30th 05 07:02 PM
How to create LOG file for commands executed in VB..? Dayanand Excel Programming 5 June 3rd 04 12:46 PM
Macro not executed Excel -- PowerPoint rick_deacha Excel Programming 0 February 24th 04 04:55 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"