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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Tim_Field

New Member
Joined
Jan 19, 2004
Messages
5
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:
 

Tim_Field

New Member
Joined
Jan 19, 2004
Messages
5
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.
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,102
Messages
5,768,102
Members
425,454
Latest member
khoro

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
Top