style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"timbar" <timbar@att.net> wroteHi
in message
href="news:f1967a6.1@WebX.maYIadrTaRb">news:f1967a6.1@WebX.maYIadrTaRb...
Laurie,
Your advise is right on. I'm just learning AutoCAD VBA. It's similar to
other VB scripting languages I've used. I don't know all the syntax, but learn
what I need, as I go.
Now that I understand how the SendCommand can be used to execute a _script
command (or other command-line commands), I think I can implement it, and
place the script run within the broader VBA run (as you advised), so it'll
work the way I want.
As mentioned previously, my task is to write a VBA program to open a new
drawing, run a script (now with the VBA SendCommand "script" command), and
then save and close the drawing. The script I'm trying to run is a "3dmesh
command" script.
Since I'm not totally up to speed with VBA, I'm still running into some
syntax problems. What I need to know (hopefully you can help), is:
How can I replace the "Select Script File" dialog I get when I type in
"script" on the AutoCad command line with an appropriate VBA command line. The
VBA command line I'm using is:
ThisDrawing.SendCommand "_script" & vbCr & filenameSCR & vbCr
where the variable filenameSCR is
filenameSCR = path15 + foldername + "\" + fileName + ".scr"
and where the path, foldername and filename variables are pointers to the
script file location on my computer hard drive.
My folder and file names have "spaces" in the name string, so the script
command (when executed from the command line) rejects the names because of the
spaces. The script command reads the folder and file names incorrectly in
pieces.
The "Select Script File" dialog doesn't have this problem. Using this
dialog, and highlighting the desired (scr) file, and opening the selected file
works OK (even with the spaces included in the name). It's this type of
functionality that I'd like to replicate with VBA.
I've come across some AutoCAD Help info on VBA file selection for opening
files (in my particular case, using the Select Script File dialog), but I've
lost the "help" for the moment.
This may be a new forum question, but since you were right on the first
time, I thought I'd ask you about -
how to select files to open (in this case a script file) in VBA using the
"select file dialog" approach.
I hope I've presented my question clearly. Thanks for your previous help,
and any additional advise you may have.
Tim Barbour
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"timbar" <timbar@att.net> wroteHi
in message
href="news:f1967a6.1@WebX.maYIadrTaRb">news:f1967a6.1@WebX.maYIadrTaRb...
Laurie,
Your advise is right on. I'm just learning AutoCAD VBA. It's similar to
other VB scripting languages I've used. I don't know all the syntax, but learn
what I need, as I go.
Now that I understand how the SendCommand can be used to execute a _script
command (or other command-line commands), I think I can implement it, and
place the script run within the broader VBA run (as you advised), so it'll
work the way I want.
As mentioned previously, my task is to write a VBA program to open a new
drawing, run a script (now with the VBA SendCommand "script" command), and
then save and close the drawing. The script I'm trying to run is a "3dmesh
command" script.
Since I'm not totally up to speed with VBA, I'm still running into some
syntax problems. What I need to know (hopefully you can help), is:
How can I replace the "Select Script File" dialog I get when I type in
"script" on the AutoCad command line with an appropriate VBA command line. The
VBA command line I'm using is:
ThisDrawing.SendCommand "_script" & vbCr & filenameSCR & vbCr
where the variable filenameSCR is
filenameSCR = path15 + foldername + "\" + fileName + ".scr"
and where the path, foldername and filename variables are pointers to the
script file location on my computer hard drive.
My folder and file names have "spaces" in the name string, so the script
command (when executed from the command line) rejects the names because of the
spaces. The script command reads the folder and file names incorrectly in
pieces.
The "Select Script File" dialog doesn't have this problem. Using this
dialog, and highlighting the desired (scr) file, and opening the selected file
works OK (even with the spaces included in the name). It's this type of
functionality that I'd like to replicate with VBA.
I've come across some AutoCAD Help info on VBA file selection for opening
files (in my particular case, using the Select Script File dialog), but I've
lost the "help" for the moment.
This may be a new forum question, but since you were right on the first
time, I thought I'd ask you about -
how to select files to open (in this case a script file) in VBA using the
"select file dialog" approach.
I hope I've presented my question clearly. Thanks for your previous help,
and any additional advise you may have.
Tim Barbour
Hi laurie
i dono vba .
i want to open autocad from the excell using vba and run the scr file i like in autocad how can i accomplish it i need exact code to do so,
my scr file is test.scr and file location :d\ so can anyone plse tell exact code to load this scr file and i need run some other vba code at the end of this code how can i control that tooo some one explain plse .