Windows Script Host (WSH) is powerful. Every windows since Win95 come with default installation of WSH and two languages are supported, JScript (Microsoft’s implementation of Javascript) and VBScript.
Creating Automation Objects is easy. In VBScript, the syntax would be to use CreateObject function and in JScript it corresponds to new ActiveXObject function.
The below is a sample script in VBScript to open an excel file and bring the Excel Application to front.
' codingforspeed.com
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
' directory in which this script is currently running
CurrentDirectory = fso.GetAbsolutePathName(".")
Dim csv: csv = fso.BuildPath(CurrentDirectory, "sample.csv")
Dim Excel
Set Excel = CreateObject("Excel.Application")
Excel.Application.Visible = True
Excel.WorkBooks.Open csv
' App Activate, bring to front
CreateObject("WScript.Shell").AppActivate Excel.Name
–EOF (The Ultimate Computing & Technology Blog) —
164 wordsLast Post: Happy Valentine's Day, another heart equation
Next Post: Variable Scopes in VBScript at Windows Script Host
Thanks, i used this code and worked. But i want my directory be a variable created by time update. How could work?