Hello,
I want to create a macro with will be location independent. Right now I have issue with getting string containing location where macro starts.
Using code listed below I get an error msg: Object required 'WScript'
Sub CATMain()
Set objShell = CreateObject("Wscript.Shell")
strPath = Wscript.ScriptFullName <- error in this line
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile)
msgbox strFolder
End Sub
Can someone help me here ?
Thanks,
Michal
I want to create a macro with will be location independent. Right now I have issue with getting string containing location where macro starts.
Using code listed below I get an error msg: Object required 'WScript'
Sub CATMain()
Set objShell = CreateObject("Wscript.Shell")
strPath = Wscript.ScriptFullName <- error in this line
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile)
msgbox strFolder
End Sub
Can someone help me here ?
Thanks,
Michal