![]() |
Get path to current workbook
If I have a workbook that can be copied to and used in any
arbitrary folder, that means each workbook will have a different path. Is there a way to determine the path of a workbook?? (Or path of "ThisWorkbook") Thank you! |
Get path to current workbook
Hi Robert,
Dim strpath As String strpath = ThisWorkbook.Path -- Regards, OssieMac "Robert Crandal" wrote: If I have a workbook that can be copied to and used in any arbitrary folder, that means each workbook will have a different path. Is there a way to determine the path of a workbook?? (Or path of "ThisWorkbook") Thank you! . |
Get path to current workbook
On Dec 26, 5:37*am, "Robert Crandal" wrote:
If I have a workbook that can be copied to and used in any arbitrary folder, that means each workbook will have a different path. Is there a way to determine the path of a workbook?? (Or path of "ThisWorkbook") Thank you! Hey Robert! I use this function below. It presents a "click-and-choose" menu where the user picks the folder he wants. Then the code returns it as a string for you to work. Quite simple, isn't? First, declare this TYPE in your module: Public Type BrowseInfo hWndOwner As Long pIDLRoot As Long pszDisplayName As Long lpszTitle As Long ulFlags As Long lpfnCallback As Long lParam As Long iImage As Long End Type Then, use the code below: Public Function folder_win() As String Dim lpIDList As Long Dim folder As String Dim browse As BrowseInfo ' This TYPE was declared right above lpIDList = SHBrowseForFolder(browse) If (lpIDList) Then folder = Space(260) SHGetPathFromIDList lpIDList, folder folder = Left(folder, InStr(folder, vbNullChar)) folder_win = folder End If End Function Hope it helped you out! Brazillian Hugs! Ronaldo PARIS |
All times are GMT +1. The time now is 12:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com