Setting variable with Environ()

Setting variable with Environ()

Anonymous
Not applicable
260 Views
1 Reply
Message 1 of 2

Setting variable with Environ()

Anonymous
Not applicable
I have a routine that opens multiple drawings in sequence, runs a series of cleanup routines, and closes the drawing. To avoid problems, SDI mode is set to 1 prior to launching.
In the macro button, I use this code to save the user's SDI mode before setting it to 1:
"^C^C(setenv "sdiprev" (getvar "sdi));sdi;1;vbastmt;frm1.show;;"

At the end of the VBA program, I'm using this statement, but it's giving me an error:
"ThisDrawing.SetVariable "SDI", Environ(sdiprev)"

Is this not the proper syntax? Any advice would be greatly appreciated.

~Buddy Deal
Wick Fisher White
Consulting Engineers
0 Likes
261 Views
1 Reply
Reply (1)
Message 2 of 2

Ed__Jobe
Mentor
Mentor
The (setenv) function sets AutoCAD "environment" variables. These are variables stored in acad defined locations in the registry. Autocad calls these "environment" variables to differentiate from those saved in the dwg file. The vb Environ function deals with OS environment variables. They are accessed by selecting MyComputer>Properties or Control Panel> System. An example would be the PATH sysvar. IOW, they deal with different "environments".

For what you are trying to do, see this thread:
http://discussion.autodesk.com/thread.jspa?threadID=567018

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes