How to send a system command with VBA

How to send a system command with VBA

Anonymous
Not applicable
428 Views
3 Replies
Message 1 of 4

How to send a system command with VBA

Anonymous
Not applicable
Hi,

I would like to know how execute a windows system command in AutoCAD VBA

I want to rename files

Thanks for your help
0 Likes
429 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Shelling to the system is not required. The "Name" command in VBA does this for you.

example:
Name "c:\temp\myfile.txt" As "c:\temp\mynewfile.txt"

You can also do a quick and dirty MOVE command by renaming a file using a different folder name, as long as the folder name already exists, and is "moved" to the same drive:

example:
Name "c:\temp\myfile.txt" As "c:\Jobs\MyFile.txt"
0 Likes
Message 3 of 4

Anonymous
Not applicable
Fine, thanks for help
0 Likes
Message 4 of 4

Anonymous
Not applicable
Add a reference to Microsoft Scripting Runtime In code you can declare a FileSystemObject.
In VBA poorly documented, but on MSDN you will find plenty. You can do almost anything with it,
write/read/move/checkexists etc.
0 Likes