LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Excel Parameters???

Instead of putting them in an environment variable, how about just creating a
text file and putting them there.


andrewsc wrote:

Telly,

I was about to ask the same question, because the solution I have is
not perfect. You could use it, neverhteless.

I am starting XLS files from BAT scripts. The Auto_Open macro needs to
open a CVS file, formats it, saves it as XLS, then exist. Just like
yourself, I need to pass some parameters to the Auto_Open macro (in my
case, two strings).

My solution is to use environment variables. The BAT script sets the
values, for example
SET MYVAR=c:\alpha\beta\gamma.txt
Then, in VBA code, I have

Dim mystr as String
mystr = Environ("MYVAR")

This works quite nicely, except ....
If excel is already running when I invoke the XLS file from BAT, then
no new process is started. Instead, Windows is using DDE to talk to the
pre-existing Excel process, and make it open my XLS file wuith the
macro.

If the Exel process was started up beforehand, then it does not inherit
the environment variables from my BAT file.

In a nutshell, this solution only works if no other instance of Excel
is running.

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


--

Dave Peterson

 
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
Excel Query Parameters jason Excel Discussion (Misc queries) 1 February 8th 09 10:02 PM
.bat file in Excel with parameters Ashly A K Excel Discussion (Misc queries) 5 June 14th 07 05:44 PM
Excel web queries using parameters Rob Cherry Excel Discussion (Misc queries) 6 March 19th 07 01:33 AM
Use of Parameters in Excel sarjak Excel Discussion (Misc queries) 7 February 1st 06 06:42 PM
Parameters in Excel Brandon Williams Excel Discussion (Misc queries) 3 October 18th 05 01:56 PM


All times are GMT +1. The time now is 04:55 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"