ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get the path where a shortcut of an Excel sheet is located (https://www.excelbanter.com/excel-programming/393682-how-get-path-where-shortcut-excel-sheet-located.html)

Stefan Mueller[_2_]

How to get the path where a shortcut of an Excel sheet is located
 
If you start an Excel sheet (e.g. Test.xls) you can get the path where
the Excel sheet is located with
MsgBox (ActiveWorkbook.Path)

Now you create a shortcut (e.g. Shortcut of Test.xls) and move it to
another directory. If you start that shortcut
MsgBox (ActiveWorkbook.Path)
still shows the path where the Excel sheet is located.

Does someone know how to get the path where the shortcut is located?

PS: In real VB I do it with a FileListBox: MsgBox (FileListBox1.Path)


barnabel

How to get the path where a shortcut of an Excel sheet is located
 
Sorry, I am pretty sure that the OS does the translation of the sortcut and
Excel is passed the real file not the shortcut. So there is no way from
inside Excel to know where the shortcut is.

Peter

"Stefan Mueller" wrote:

If you start an Excel sheet (e.g. Test.xls) you can get the path where
the Excel sheet is located with
MsgBox (ActiveWorkbook.Path)

Now you create a shortcut (e.g. Shortcut of Test.xls) and move it to
another directory. If you start that shortcut
MsgBox (ActiveWorkbook.Path)
still shows the path where the Excel sheet is located.

Does someone know how to get the path where the shortcut is located?

PS: In real VB I do it with a FileListBox: MsgBox (FileListBox1.Path)



Stefan Mueller[_2_]

How to get the path where a shortcut of an Excel sheet is located
 
Hmm, but how can the VB's FileListBox do it?
Actually, the VB FileListBox doesn't show the path where the shortcut
is located, it shows the path entered in 'Start in:' of the shortcut.

Do you think I can somehow get this information within Excel?



All times are GMT +1. The time now is 06:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com