Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Martin,
And if you don't have a drive mapping, try this: Quote from Tom Ogilvy: Here is some code frequently posted by Rob Bovey in response to this question: Private Declare Function SetCurrentDirectoryA Lib "kernel32" _ (ByVal lpPathName As String) As Long Public Sub bSetUNCPath(ByVal szPathToSet As String) Dim lReturn As Long lReturn = SetCurrentDirectoryA(szPathToSet) End Sub This sets the specified Network Path as the Default. Then use Application.GetOpenFileName HTH, Bernie MS Excel MVP "Martin Los" wrote in message ... I want to set the path to a network for the following macro: Sub OpenMultipleFiles() Dim fn As Variant, f As Integer Dim MyPath As String MyPath = "\\network\subdirectory\" ChDir MyPath fn = Application.GetOpenFilename("Excel-files,*.xls", _ 1, "Select one or more files to open", , True) If TypeName(fn) = "Boolean" Then Exit Sub For f = 1 To UBound(fn) Debug.Print "Selected file #" & f & ": " & fn(f) Workbooks.Open fn(f) MsgBox ActiveWorkbook.Name, , "Active Workbook Name:" ActiveWorkbook.Close False ' close the active workbook without saving any changes Next f End Sub However, the GetOpenFilename dialog does NOT go to the network. Can anybody tell me how to solve this? TIA Martin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I set a default path when using Application.GetOpenFilename | Excel Programming | |||
How do I set a default path when using Application.GetOpenFilename | Excel Programming | |||
GetOpenFilename Dialog default path | Excel Programming | |||
path names in getopenfilename | Excel Programming | |||
GetopenFilename default path | Excel Programming |