I have a VBScript file to open an Excel file and run a macro. This Excel file is located in the same folder as the VBScript file. I would like to use relative paths to call it, so that I can move that folder around without rewriting the paths in the script. Right now my VBScript looks like this:
Option Explicit
On Error Resume Next
ExcelMacroExample
Sub ExcelMacroExample()
Dim xlApp
Dim xlBook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\Users\Ben\Desktop\GeocodingBatchFile\Files\GeocodingStart.xlsm")
xlApp.Run "Export"
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
Rather than using the full file path, it would be great if I could do something like this:
Set xlBook = xlApp.Workbooks.Open(".\GeocodingStart.xlsm")