STUCK! Start Excel ReportTest.xlt ReportData.txt ......

Tim_Field

New Member
Joined
Jan 19, 2004
Messages
5
Hi All,

This is something that appears to have been answered elsewhere but all the solutions aren't working.

I'm trying to open a text file and apply my template to it (contains a macro). Doing the command Start Excel ReportTest.xlt ReportData.txt
just loads excel twice.

The following doesn't return a string so I can't read off the arguements:
Dim CmdLine As String
CmdLine = GetCommandLineA

same with this:
Dim CmdLine As String
CmdLine = GetCommandLine

I'm using Windows XP Pro and Excel 2000

Can anyone help!? I'm totally stuck.... This code will actually be called from C# so I MUST use a command line.

Thanks! Tim :oops:
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
No chance! Already tried that.....

I've already done this solution and it doesn't work.....

please note my origional msg....

-The following doesn't return a string so I can't read off the arguements:
-Dim CmdLine As String
-CmdLine = GetCommandLineA
-same with this:
-Dim CmdLine As String
-CmdLine = GetCommandLine

Thanks Tim :rolleyes:
 
Upvote 0
FULL INFO BELOW....


Trying to achieve:

Open with a template and a txt file...
This template (containing a macro) should format the text.

Tried:
1)
start excel ReportData.txt ReportTest.xlt
and
start excel ReportTest.xlt ReportData.txt

Opens up two workbooks (separate).

2)
Create an environment variable from within C# *in this case just in Cmd prompt
Read the variable in VBA.... Doesn't work

3)
Create a command line with parameters...
e.g.
start excel "/e/ReportTest.xlt/ReportData.txt"

This reference the command object from VBA
Declare Function GetCommandLine Lib "kernel32" () As String
OR
VBA.Command$
OR
MsgBox GetCommandLineW
OR
MsgBox GetCommandLine


All give nothing back.
 
Upvote 0
Another possibility would be to store the name of the file you wish to process in a text file. Then read that file name from the text file in your Workbook_Open event procedure.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,867
Members
449,053
Latest member
Mesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top