Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Changing to Network Directory

I'm trying to create a macro, which when executed, will
display the "File Open" dialog box for Excel. However I
want the dialog box to open up in a Network directory.

The below macro executes just fine when tested in a blank
workbook. When I add the code to the application I've
created I can't seem to get to the Network directory.

Can anyone recommend a solution or tell me why this macro
isn't working?

Given:
The Network Workgroup is "Advantage".
The Network computer name is "Advint01".
The Network Drive is: "D:\" but displayed as "D Drive".
The Operating System on the desktop is "Windows XP"
The Operating System on the Network is "Windows 2000"
The Excel Version is "2002"

Code:

Sub File_Open_Network()
' Uses the File Open dialog box for the Network
' directory where all estimate files are store
ChDir "\\Advint01\D Drive\Quotes\Contracting"
fileToOpen = Application.GetOpenFilename_
("WorkSheets (*.xls), *.xls", , "Network Drive")
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing to Network Directory

' Placed at the top of the module
Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long

Sub ChDirNet(szPath As String)
' provided by Rob Bovey
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
' Debug.Print lReturn
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting path."
End Sub

Sub File_Open_Network()
' Uses the File Open dialog box for the Network
' directory where all estimate files are store
'
' use chdirnet rather than chdir
'

ChDirNet "\\Advint01\D Drive\Quotes\Contracting"
fileToOpen = Application.GetOpenFilename_
("WorkSheets (*.xls), *.xls", , "Network Drive")
End Sub


--
Regards,
Tom Ogilvy

"Dan Marr" wrote in message
...
I'm trying to create a macro, which when executed, will
display the "File Open" dialog box for Excel. However I
want the dialog box to open up in a Network directory.

The below macro executes just fine when tested in a blank
workbook. When I add the code to the application I've
created I can't seem to get to the Network directory.

Can anyone recommend a solution or tell me why this macro
isn't working?

Given:
The Network Workgroup is "Advantage".
The Network computer name is "Advint01".
The Network Drive is: "D:\" but displayed as "D Drive".
The Operating System on the desktop is "Windows XP"
The Operating System on the Network is "Windows 2000"
The Excel Version is "2002"

Code:

Sub File_Open_Network()
' Uses the File Open dialog box for the Network
' directory where all estimate files are store
ChDir "\\Advint01\D Drive\Quotes\Contracting"
fileToOpen = Application.GetOpenFilename_
("WorkSheets (*.xls), *.xls", , "Network Drive")
End Sub



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
colour changing within network david wiggins Excel Discussion (Misc queries) 0 October 9th 07 04:26 PM
Unknown excel backup files created in network directory Mike Excel Discussion (Misc queries) 0 September 18th 07 01:26 PM
How to change options for saving when old directory(network) gone Mel Ackerman Setting up and Configuration of Excel 3 August 10th 06 10:10 PM
Changing to different drive and directory Rob Excel Discussion (Misc queries) 5 July 20th 06 04:12 AM
Saving files in the same network directory takes too long time!! tev Setting up and Configuration of Excel 2 March 9th 05 09:05 PM


All times are GMT +1. The time now is 09:03 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"