March 2, 2009 at 5:49 pm #7009
Yutaka Emura
Keymaster
shx wrote:
Using a macro I am copy the currently open file to a another file with the same name and a different extension.
The copy works and the file is copied.
However, when I execute
“editor.OpenFile pxbfilename ” it fails and says it can not execute the command.Why?
The Code
Set fso = CreateObject( “Scripting.FileSystemObject” )
thefullfilename = document.FullName
pxbfilename = Replace(thefullfilename,”.pub”,”.pxb” )
fso.CopyFile document.FullName, pxbfilename
editor.OpenFile pxbfilenameSteven
It should work, but may be you should insert “Sleep” method between CopyFile and OpenFile. Can you try adding
Sleep 1000
before OpenFile method?