New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

creating a relative path in .vbs file

Macros, VBA, Excel Automation, etc.

creating a relative path in .vbs file

Postby Hany0 » Thu Jan 21, 2016 11:58 pm

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
http://tex.stackexchange.com/questions/283318/link-to-a-specific-worksheet-in-an-excel-file

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
http://stackoverflow.com/questions/8854263/what-the-win-cmd-to-open-a-particular-spreadsheet-in-excel

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 in
http://stackoverflow.com/questions/34460028/editing-vbs-to-accept-a-parameter

but I got no answer
  • 0

Hany0
Rookie
 
Posts: 11
Joined: Jan 8, 2016
Reputation: 0
Excel Version: 2003

Re: creating a relative path in .vbs file

Postby Hany0 » Tue Jan 26, 2016 3:39 am

  • 0

Hany0
Rookie
 
Posts: 11
Joined: Jan 8, 2016
Reputation: 0
Excel Version: 2003


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 127 guests