on 10-02-2015 8:33 PM
Hi,
I have recorded attached script and save as .vbs format when i run the macro i am getting error ( attached is the screen shot of error).
Also can you please help me how to run this script through excel macro because right now i have to manually edit the the date in script and then run the script.
session.findById("wnd[0]/usr/ctxtSO_AUGDT-LOW").text = "10.09.2015"
session.findById("wnd[0]/usr/ctxtSO_AUGDT-HIGH").text = "15.09.2015"
I want to above date function under excel so i can just change the date in excel and the run the Macro.
Please guide me how to run the SAP script through excel macro. I am using excel 2013 version.
Hope i am able to explain my query.
Thanks in advance!!!!
Thanks,
Rahul
Hi Thomas,
Any update on code?
Thanks,
Rahul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
there are tow different Ways to for your first Problem (Date)
First you can use a InputBox for each Date
min_dat= InputBox("Insert Minimal Date")
if min_dat <> False or min_dat<> "" then
session.findById("wnd[0]/usr/ctxtSO_AUGDT-LOW").text = min_dat
end if
Same goes for the High-Date
or you can calculate the Dates via DateAdd and format the Dates via Format:
session.findbyID("wnd[0]/usr/ctxtSO_AUGDT-LOW").text = Format(Now),"dd.mm.yyyy")
session.findbyID("wnd[0]/usr/ctxtSO_AUGDT-HIGH").text =Format(DateAdd("d",5,now),"dd.mm.yyyy")
Greetings
Thomas B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1.Hi Thomas,
Thanks for your reply.
Can you please guide me how to use InputBox in my code? and for second code when i replace the code i got error in excel " Syntax error".
Now i know to how to run SAP script through excel. I have attached the code file. There are two code.
1.Now i want the code for save SAP excel export report to my PC with desired name for both code.
2.Once first code is complete the second code will run automatically
3.The date in second code line 18 & 19 run through excel aur automate instead of go to code and change date every time.
Hope I am able to understand my query.
Thanks in advance !!!!!
Rahul
Rahul Chure wrote:
1.Hi Thomas,
Thanks for your reply.
Can you please guide me how to use InputBox in my code?
and for second code when i replace the code i got error in excel " Syntax error".
Now i know to how to run SAP script through excel. I have attached the code file. There are two code.
1.Now i want the code for save SAP excel export report to my PC with desired name for both code.
2.Once first code is complete the second code will run automatically
3.The date in second code line 18 & 19 run through excel aur automate instead of go to code and change date every time.
Hope I am able to understand my query.
Thanks in advance !!!!!
Rahul
Hi Rahul,
I think i understand your Problem-
First of all "InpoutBox" is a Function in VB(A) (S) that prompts a Box in which the User (you) can put any thing you're asking for.tt
The Syntax to call it: InputBox ([Prompt],[Title],[Default])
The Returnvalue of the InputBox is the Value youve typed in (and Press Ok) or False if you Press Abort
By the Way -
a simple way to shorten the Codings and spare many typing is to use a Keyword "With"
I've updated your Code a bit and built in a way to handle with Inputboxes-
this should work at least (cant test it because dont have currently Acces to SAP)
greetings
Thomas
Hello.
this is an issue with Label of GoTo-statement,
Use numbers as Expression:
************************************************************************************************
.....
10:
min_date = InputBox("Please insert Minimum-Date")
If min_date <> "" Or min_date <> False Then
If IsDate(min_date) Then
.findById("wnd[0]/usr/ctxtSO_AUGDT-LOW").Text = min_date
End If
Else
MsgBox "Not a Valid Date", vbOKOnly
GoTo 10
End If
20:
max_date = InputBox("Please Insert Maximum Date")
If max_date <> "" Or max_date <> False Then
If IsDate(max_date) Then
.findById("wnd[0]/usr/ctxtSO_AUGDT-HIGH").Text = max_date
Else
GoTo 20
End If
Else
GoTo 20
End If
.....
************************************************************************************************
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.