change curdir to a folder on a network
I would like VBA to change the folder that is displayed when using the
(workbook) OPEN dialog box to a folder that resides on a network drive/computer. let's say the file open dialog box opens to "C:\OldFolder" (and curdir displays "C:\OldFolder" ) let's say I want the file open dialog box to display a folder on a network "\\Newton\c\FolderIWant" chdrive "\\Newton\c" doesn't work chdir "\\Newton\c\FolderIWant" " doesn't work and Application.DefaultFilePath = "\\Newton\c\FolderIWant" msgbox Application.DefaultFilePath does give me "\\Newton\c\FolderIWant" [in the message box] HOWEVER neither curdir nor file open dialog box changes to "\\Newton\c\FolderIWant" They both still are on "C:\OldFolder" What do I do????? Thank you! |
change curdir to a folder on a network
I've seen the need to included A LAST "\" in the Path reference,, like:
"\\Newton\c\FolderIWant\" Give that I try.. HTH wrote in message oups.com... I would like VBA to change the folder that is displayed when using the (workbook) OPEN dialog box to a folder that resides on a network drive/computer. let's say the file open dialog box opens to "C:\OldFolder" (and curdir displays "C:\OldFolder" ) let's say I want the file open dialog box to display a folder on a network "\\Newton\c\FolderIWant" chdrive "\\Newton\c" doesn't work chdir "\\Newton\c\FolderIWant" " doesn't work and Application.DefaultFilePath = "\\Newton\c\FolderIWant" msgbox Application.DefaultFilePath does give me "\\Newton\c\FolderIWant" [in the message box] HOWEVER neither curdir nor file open dialog box changes to "\\Newton\c\FolderIWant" They both still are on "C:\OldFolder" What do I do????? Thank you! |
change curdir to a folder on a network
Richard,
Try this Private Declare Function SetCurrentDirectoryA _ Lib "kernel32" (ByVal lpPathName As String) As Long Sub SetUNCPath() SetCurrentDirectoryA "\\Newton\c\FolderIWant" End Sub -- HTH Bob Phillips wrote in message oups.com... I would like VBA to change the folder that is displayed when using the (workbook) OPEN dialog box to a folder that resides on a network drive/computer. let's say the file open dialog box opens to "C:\OldFolder" (and curdir displays "C:\OldFolder" ) let's say I want the file open dialog box to display a folder on a network "\\Newton\c\FolderIWant" chdrive "\\Newton\c" doesn't work chdir "\\Newton\c\FolderIWant" " doesn't work and Application.DefaultFilePath = "\\Newton\c\FolderIWant" msgbox Application.DefaultFilePath does give me "\\Newton\c\FolderIWant" [in the message box] HOWEVER neither curdir nor file open dialog box changes to "\\Newton\c\FolderIWant" They both still are on "C:\OldFolder" What do I do????? Thank you! |
All times are GMT +1. The time now is 12:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com