cancel
Showing results for 
Search instead for 
Did you mean: 

Vbscript for save as window?

Former Member
0 Kudos

Hi Guys,

I wonder if there is any way to use a vbscript for save as window.

For example I created a script for generating a report automatically and everything goes fine till the save as window.

It seems that this window is not object in SAP and I don’t know how to modify the script in order to save the report.

Please let me know if you have any idea.

Regards,

Guerolito

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_brutigam2
Active Participant
0 Kudos

Hi Guerolito,

yes youre right - the save as window is from Windows and cant be accessed "directly" from your Basic Script ....

but there is a Way to do:


look here:http://scn.sap.com/message/8219341#8219341

Former Member
0 Kudos

Hi,

I’m sorry but I’m not fully aware how to implement the example you provided.

As far as understand this script initiates another previously created with this:

Path = inputbox("Please enter a filename: ","filename","c:\tmp\test.htm")

set Wshell = CreateObject("WScript.Shell")

wshell.run """c:\tmp\save_as.vbs """ & Path


And the previously created script is:

if Wscript.Arguments.count > 0 then

set fs = CreateObject("Scripting.FileSystemObject")

if fs.fileExists(WScript.arguments(0)) then

  Set myfile = fs.GetFile(WScript.arguments(0))

  myfile.Delete

end if

set Wshell = CreateObject("WScript.Shell")

Do

  bWindowFound = Wshell.AppActivate("Save As")

  WScript.Sleep 1000

Loop Until bWindowFound

Do

  Wshell.appActivate "Save As"

  Wshell.sendkeys WScript.arguments(0)

  WScript.Sleep 400

  Wshell.appActivate "Save As"

  Wshell.sendkeys "%s"

  WScript.Sleep 400

  bWindowFound = Wshell.AppActivate("Save As")

  WScript.Sleep 400

Loop Until not bWindowFound

end if

Can you give some additional information on the script?

I don’t know much for WSH object model and currently reading for it.

One more question- Is it possible this code to be used when pdf files are generated for example POs?

Thank you and regards

Guerolito

Former Member
0 Kudos

Did you manage to solve this?