Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default 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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HyperLink to a folder on other drive on the same network (LAN) klj Excel Worksheet Functions 6 October 9th 09 02:50 PM
Folder Network drive Wanna Learn Excel Discussion (Misc queries) 1 May 30th 08 06:42 PM
SetUp Templates in Network Folder Rick Stambach Setting up and Configuration of Excel 0 December 7th 07 04:43 AM
Outlook attachment to network folder Ozzie via OfficeKB.com Excel Discussion (Misc queries) 2 February 3rd 06 11:19 AM
Can't 'SaveAs' Directly to Network Folder jbl25[_6_] Excel Programming 3 July 7th 05 02:36 PM


All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"