# Implement Variables onto VBScript

**URL:** <https://forum.uipath.com/t/implement-variables-onto-vbscript/522208>\
**Category:** Activities\
**Tags:** variable, question, sap, script, activities\
**Created:** [March 1, 2023, 8:59pm UTC](https://forum.uipath.com/t/implement-variables-onto-vbscript/522208 "2023-03-01T20:59:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![josue07ortiz](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@josue07ortiz](https://forum.uipath.com/u/josue07ortiz)\
**Post date:** [March 1, 2023, 8:59pm UTC](https://forum.uipath.com/t/implement-variables-onto-vbscript/522208/1 "2023-03-01T20:59:00Z")

</div>

Hi All, I’m currently creating a small data extraction bot with SAP. I created the following variables in Studio via Activity Input Dialog - SelectedDate , SelectedMonth, & SelectedYear. I did a script record and am now trying to implement the variables in the VBscript, but having trouble. Anyone know I can implement the variables created in Studio onto the following VBscript to replace “11.01.2023”? The code follows:

If Not IsObject(application) Then  
Set SapGuiAuto = GetObject(“SAPGUI”)  
Set application = SapGuiAuto.GetScriptingEngine  
End If  
If Not IsObject(connection) Then  
Set connection = application.Children(0)  
End If  
If Not IsObject(session) Then  
Set session = connection.Children(0)  
End If  
If IsObject(WScript) Then  
WScript.ConnectObject session, “on”  
WScript.ConnectObject application, “on”  
End If  
session.findById(“wnd[0]”).maximize  
session.findById(“wnd[0]/usr/cntlIMAGE\_CONTAINER/shellcont/shell/shellcont[0]/shell”).selectedNode = “F00002”  
session.findById(“wnd[0]/usr/cntlIMAGE\_CONTAINER/shellcont/shell/shellcont[0]/shell”).doubleClickNode “F00002”  
session.findById(“wnd[0]/usr/ctxtFKDAT-LOW”).text = “11.01.2023”

---

<div class="post-metadata">

**Author:** ![Kalpesh\_Chaudhari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kalpesh_chaudhari/32/241531_2.png) [@Kalpesh\_Chaudhari](https://forum.uipath.com/u/Kalpesh_Chaudhari)\
**Post date:** [March 2, 2023, 9:43am UTC](https://forum.uipath.com/t/implement-variables-onto-vbscript/522208/2 "2023-03-02T09:43:13Z")

</div>

Hi,

You need to write above code in a function and pass variable to that function as a variable:

function(your\_variable)  
{  
your code  
e.g. Set SapGuiAuto = GetObject(your\_variable)  
}

pls mark it as solution if this solves your issue

Thanks
