ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command line parameters to Excel (https://www.excelbanter.com/excel-programming/274333-command-line-parameters-excel.html)

Tom Walker

Command line parameters to Excel
 
Hi,

I would be opening an excel spreadsheet from a
powerbuilder application.

Something like this:

excel myexcelsheet.xls thisistheparam

where "thisistheparam" is my parameter. How would I
access the string "thisistheparam" in workbook_open event?

Thanks,
Tom


sus[_2_]

Command line parameters to Excel
 
I am also interested in finding the answer to this problem

--
Message posted from http://www.ExcelForum.com


riveaira

Command line parameters to Excel
 
I would LOVE to know how to do this too! Has anyone found a way? ;

--
Message posted from http://www.ExcelForum.com


Steve Garman

Command line parameters to Excel
 
I've just briefly tested a horrible kludge using a batch file and an
environment variable.
This is tested on Windows XP only, with the call made from a desktop
shortcut, or from shell within VB5.

I created a 2-line batch file, callXL.bat

set xl_command_line=%2 %3 %4 %5 %6 %7 %8 %9
%1

I then call the batch file with the workbook path as the first
parameter, followed by any other parameters

(in a shortcut)
C:\callXL.bat "C:\SJGtest.xls" hello world

(or from VB)
Shell "C:\callXL.bat ""C:\SJGtest.xls"" hello world"

and, in the workbook, it is retrieved using:

Private Sub Test()
MsgBox Environ("xl_command_line")
End Sub



riveaira < wrote:
I would LOVE to know how to do this too! Has anyone found a way? ;)


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 01:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com