I have a pdf file, generated by Latex, which contains hyperlinks to open an excel file (excel 2003). I posted a question to Latex forums in enter link description here so that I can make each link opens the excel file on a specific cell; but no one could give me the answer. I found an answer by brettdj in enter link description here
which uses a vbs file to open a specif cell in the excel file. The problem is that the file location (in strFileName =) is an absolute, so when I take the vbs and excel file to another folder
or to another computer, the link does not work; and a message "file not found" is displayed.
Is there a way to do this, or to make the path to the excel file relative to where the vbs file is located; so that when the vbs
and excel files are moved to another location the file can still be opened.
I posted this question inenter link description herebut I got no answer
1 Answer
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim CurrentDirectory
CurrentDirectory = objFSO.GetAbsolutePathName(".")I saved the VBS as C:\Users\Jonno\Documents\test.vbs - It gives the output C:\Users\Jonno\Documents. To use it put something like
strFileName = CurrentDirectory & "\test.xlsx" 0