Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bumin
Partner - Creator II
Partner - Creator II

DOS-Command in a macro

Hi,

has anyone an example how to enter a DOS-Command in a QV-macro?

I want ro rename a file within a macro

thanks

Bumin

1 Solution

Accepted Solutions
Not applicable

Hi Bumin,

The below macro (vbscript) will do the job without the need for a dos command:

sub renamefile

set obj = CreateObject("Scripting.FileSystemObject")

strFile = "C:\Users\Test\Desktop\QVW\s.csv"

strRename = "C:\Users\Test\Desktop\QVW\sRenamed.csv"

if obj.FileExists(strFile) then

obj.MoveFile strFile, strRename

else

msgbox("File Doesn't Exist")

end if

set obj = nothing

end sub

Make sure to set the security flag to "allow system access".

Hope this helps.

View solution in original post

4 Replies
Not applicable

Hi Bumin,

The below macro (vbscript) will do the job without the need for a dos command:

sub renamefile

set obj = CreateObject("Scripting.FileSystemObject")

strFile = "C:\Users\Test\Desktop\QVW\s.csv"

strRename = "C:\Users\Test\Desktop\QVW\sRenamed.csv"

if obj.FileExists(strFile) then

obj.MoveFile strFile, strRename

else

msgbox("File Doesn't Exist")

end if

set obj = nothing

end sub

Make sure to set the security flag to "allow system access".

Hope this helps.

qlikpahadi07
Specialist
Specialist

perfect it worked with me

bumin
Partner - Creator II
Partner - Creator II
Author

thanks Jean-Pierre it works

Not applicable

Great

Appreciate to mark the answer as correct/helpful.