Yutaka Emura

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.


The Code
Set fso = CreateObject( “Scripting.FileSystemObject” )
thefullfilename = document.FullName
pxbfilename = Replace(thefullfilename,”.pub”,”.pxb” )
fso.CopyFile document.FullName, pxbfilename
editor.OpenFile pxbfilename


It should work, but may be you should insert “Sleep” method between CopyFile and OpenFile. Can you try adding

Sleep 1000

before OpenFile method?