Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub macroopen()
ChDir "\\wxp2000\Joe Docs\Joe\Reports" Application.GetOpenFilename("Excel,*.xls") End Sub how i include the path name in the get file name so that users dont have to click through all the "layers" |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Paul,
You can't change the path in this dialog. It can change only the active drive or active directory. --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul,
You can't change the path in the dialog, but I think you already knew that as you were trying a ChDir before the dialog. This works with local, or mapped drives, but will not work with a UNC path. That is a bit harder, but not too hard. Here is some code that will set the UNC path for you, and GetOpenFileName will reflect that path. Private Declare Function SetCurrentDirectoryA Lib "kernel32" _ (ByVal lpPathName As String) As Long Sub macroopen() Dim sPath As String sPath = "\\wxp2000\Joe Docs\Joe\Reports" If SetUNCPath(sPath) < 0 Then Application.GetOpenFilename ("Excel,*.xls") Else MsgBox "Error in setting the UNC path - " & sPath End If End Sub Function SetUNCPath(sPath As String) As Long Dim lReturn As Long lReturn = SetCurrentDirectoryA(sPath) SetUNCPath = lReturn End Function -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "tolgag " wrote in message ... Hi Paul, You can't change the path in this dialog. It can change only the active drive or active directory. --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Whew I am glad you think thats not to hard!!.I cant quite
make sense of how those two routines fit together.I get a compile error saying the function or sub is not defined -----Original Message----- Paul, You can't change the path in the dialog, but I think you already knew that as you were trying a ChDir before the dialog. This works with local, or mapped drives, but will not work with a UNC path. That is a bit harder, but not too hard. Here is some code that will set the UNC path for you, and GetOpenFileName will reflect that path. Private Declare Function SetCurrentDirectoryA Lib "kernel32" _ (ByVal lpPathName As String) As Long Sub macroopen() Dim sPath As String sPath = "\\wxp2000\Joe Docs\Joe\Reports" If SetUNCPath(sPath) < 0 Then Application.GetOpenFilename ("Excel,*.xls") Else MsgBox "Error in setting the UNC path - " & sPath End If End Sub Function SetUNCPath(sPath As String) As Long Dim lReturn As Long lReturn = SetCurrentDirectoryA(sPath) SetUNCPath = lReturn End Function -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "tolgag " wrote in message ... Hi Paul, You can't change the path in this dialog. It can change only the active drive or active directory. --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Names of workbooks - want relative, with no Full Path | New Users to Excel | |||
Advice long path names in formulas.... | Excel Worksheet Functions | |||
Indirect and Path & File Names | Excel Discussion (Misc queries) | |||
Recurring Problems with Links with Full Path Names | Excel Discussion (Misc queries) | |||
GetopenFilename default path | Excel Programming |