LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can't 'SaveAs' Directly to Network Folder


Hello,
I'm using the function below to pop up a "Browse for folder" window in
order to get a network file path. Later in the code I save the
workbook to the path under a new name. If I map a drive directly to
the folder I want to save to, I get a run-time 1004 error saying the
file cannot be accessed. If I map to the folder one level above where
I want to save, then select down a level in the browse window, it
works. If I start at the very top level in the browse window and
manually select all the way down to the desired location, it also
works. Also no problems when saving directly to my computer. I'm
running excel 2003 and using Lib shell32.dll. Any ideas why this is
happening? Thanks very much for your help!!

Function GetDirectory(Optional Msg) As String
Dim bInfo As Browseinfo
Dim Path As String
Dim r As Long, X As Long, pos As Integer
bInfo.pidlroot = 0&
If IsMissing(Msg) Then
bInfo.lpsztitle = "Select a folder"
Else
bInfo.lpsztitle = Msg
End If
bInfo.ulflags = &H1
X = SHBrowseforfolder(bInfo)
Path = Space$(512)
r = SHGetPathFromIDList(ByVal X, ByVal Path)
If r Then
pos = InStr(Path, Chr$(0))
GetDirectory = Left(Path, pos - 1)
Else
GetDirectory = ""
End If
End Function


--
jbl25
------------------------------------------------------------------------
jbl25's Profile: http://www.excelforum.com/member.php...fo&userid=7225
View this thread: http://www.excelforum.com/showthread...hreadid=385073

 
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
Creating a folder on SaveAs leerem Excel Discussion (Misc queries) 6 December 8th 08 12:51 PM
Folder Network drive Wanna Learn Excel Discussion (Misc queries) 1 May 30th 08 06:42 PM
SaveAS to a specific folder, with operator input of file name [email protected] Excel Discussion (Misc queries) 1 January 5th 06 03:19 PM
check and create folder for saveas Sunil Excel Programming 4 October 26th 04 01:11 PM


All times are GMT +1. The time now is 12:20 AM.

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

About Us

"It's about Microsoft Excel"