3 Replies Latest reply: Jan 24, 2013 2:29 AM by Anju Gopinath RSS

    refresh doc through macro after calling batch file

      Hi All,

       

      I am calling a batch file to reload the document from macro.

      After it is reloaded successfully,

      I want a dialogue box to be displayed saying "Reload Finished" and also execute  ActiveDocument.SetClearState

       

      This is what I did:

       

      Sub External

          Set WSHShell = CreateObject("Wscript.Shell")

          exitcode=WSHShell.Run("D:\testserver.bat",0,TRUE)---line x //this reloads the doc

              if(exitcode=0) then

           WSHShell.Popup "Reload Finished"

              ActiveDocument.SetClearState   

      end if

      End Sub

       

      But, it is timing out, I think at line x.

       

      If I give only

      WSHShell.Run("D:\testserver.bat")

      ActiveDocument.SetClearState----this doesn't get executed

       

      Hence I am not able to see the reloaded data .I have to refresh the doc manually.

      How can I solve this?

       

      -Anju