Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Sporadic errors when saving to network drive

Good morning all,

I have a rather odd problem.

I have a workbook with a cell that contains a string referring to a
foldername.
It also has cells containg a team name, the year number and the week number.
I then have some code that stores the contents of these cells to variables
and finally concatenates the whole thing and saves the file thus:

FolderName = Sheets("Database").Range("FolderName").Formula
SaveString = Year.Value & "-" & Format(WeekNumber.Value, "00") & " " &
TeamName.Value & ".xls"
ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

The problem is, that if the foldername cell is set to something local like
C:\ or D:\, the no problem. If it contains a network folder, then sometimes
it works and sometimes it doesn't - I get a "cannot access file..." message.

HOWEVER, if I save the workbook locally by changing the foldername field to
C:\ or D:\ first, then running the code, THEN change to the network folder,
it saves every time.

It's almost as though saving it successfully locally first allows it to save
to the network folder OK too.

Can anyone think of any reason as to why this might be happening?

Yours in bewilderment

Pete


  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Sporadic errors when saving to network drive

When saving to the network I usually save to the network name instead of the
drive letter on each individual computer. i.e. istead of Z:\\folder
name\file name I use \\networkname\foldername\filename

That way there is a direct link at all times.

I don't know if this is what you were looking for. Do you have multiple
users that have to open the file or is this just on your computer?


"Peter Rooney" wrote:

Good morning all,

I have a rather odd problem.

I have a workbook with a cell that contains a string referring to a
foldername.
It also has cells containg a team name, the year number and the week number.
I then have some code that stores the contents of these cells to variables
and finally concatenates the whole thing and saves the file thus:

FolderName = Sheets("Database").Range("FolderName").Formula
SaveString = Year.Value & "-" & Format(WeekNumber.Value, "00") & " " &
TeamName.Value & ".xls"
ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

The problem is, that if the foldername cell is set to something local like
C:\ or D:\, the no problem. If it contains a network folder, then sometimes
it works and sometimes it doesn't - I get a "cannot access file..." message.

HOWEVER, if I save the workbook locally by changing the foldername field to
C:\ or D:\ first, then running the code, THEN change to the network folder,
it saves every time.

It's almost as though saving it successfully locally first allows it to save
to the network folder OK too.

Can anyone think of any reason as to why this might be happening?

Yours in bewilderment

Pete


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Sporadic errors when saving to network drive

Hi, JNW,

Normally I wouldn't use drive letters either, but it seems to be the only
way in which I can avoid the problem the first time I run the "NetworkSave"
macro when I open the workbook!
The template is available for multiple users to create their own workbooks
(using the code that's causing the problem), but no two users should have any
one workbook open at the same time.

Regards

Pete



"JNW" wrote:

When saving to the network I usually save to the network name instead of the
drive letter on each individual computer. i.e. istead of Z:\\folder
name\file name I use \\networkname\foldername\filename

That way there is a direct link at all times.

I don't know if this is what you were looking for. Do you have multiple
users that have to open the file or is this just on your computer?


"Peter Rooney" wrote:

Good morning all,

I have a rather odd problem.

I have a workbook with a cell that contains a string referring to a
foldername.
It also has cells containg a team name, the year number and the week number.
I then have some code that stores the contents of these cells to variables
and finally concatenates the whole thing and saves the file thus:

FolderName = Sheets("Database").Range("FolderName").Formula
SaveString = Year.Value & "-" & Format(WeekNumber.Value, "00") & " " &
TeamName.Value & ".xls"
ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

The problem is, that if the foldername cell is set to something local like
C:\ or D:\, the no problem. If it contains a network folder, then sometimes
it works and sometimes it doesn't - I get a "cannot access file..." message.

HOWEVER, if I save the workbook locally by changing the foldername field to
C:\ or D:\ first, then running the code, THEN change to the network folder,
it saves every time.

It's almost as though saving it successfully locally first allows it to save
to the network folder OK too.

Can anyone think of any reason as to why this might be happening?

Yours in bewilderment

Pete


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
Saving Excel File to a Network Drive Jason Excel Discussion (Misc queries) 2 March 2nd 10 05:16 PM
Excel 2003 - problem saving to a mapped network drive Chris Excel Discussion (Misc queries) 1 October 17th 05 05:57 PM
Saving to network drive gives unwanted copy or overwrite message Bill Excel Discussion (Misc queries) 2 July 29th 05 02:25 AM
Link workbooks-C drive to network drive Earl Excel Worksheet Functions 0 April 19th 05 05:50 PM
Userform Local Drive & Network drive question Joel Mills Excel Programming 3 December 29th 04 10:43 PM


All times are GMT +1. The time now is 11:56 PM.

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"