View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Problem saving to network drive

Peter,

Have you tried a debug.print on the generated filename? I bet that
would show something up....
You have some duplicated code which could be simplified a bit.

Sub SaveMe()
dim SaveString as string
Application.DisplayAlerts = False
YearWeekTeamName
SetFolderName

SaveString=Year.Value & "-" & Format(WeekNumber.Value, "00") & ""

If TeamName.Value = "All Teams" Then
SaveString = SaveString & "Consolidation.xls"
Else
SaveString = SaveString & TeamName.Value & ".xls"
End If

debug.print FolderName & SaveString

ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
_
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub

Hope that helps. Also check your "YearWeekTeamName" routine below: an
extra line in there....
Also may be time to turn on Option Explicit.

Tim.



"Peter Rooney" wrote in
message ...
Tim,

Here it is:

Sub SaveMe()
Application.DisplayAlerts = False
YearWeekTeamName
SetFolderName

If TeamName.Value = "All Teams" Then
SetFolderName
SaveString = Year.Value & "-" & Format(WeekNumber.Value,
"00") & " "
& "Consolidation.xls"
ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
_
ReadOnlyRecommended:=False, CreateBackup:=False
Else
SaveString = Year.Value & "-" & Format(WeekNumber.Value,
"00") & " "
& TeamName.Value & ".xls"
ActiveWorkbook.SaveAs Filename:=FolderName & SaveString, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="",
_
ReadOnlyRecommended:=False, CreateBackup:=False
End If
End Sub

Sub YearWeekTeamName() 'defines cells containing entries to make up
filename
Set WeekNumber = Sheets("Database").Range("WeekNumber")
Set Year = Sheets("Database").Range("Year")
Set TeamName = Sheets("Database").Range("TeamName")
Set TeamName = DBSheet.Range("TeamName")
end sub


### You're setting TeamName twice - is this the same range ??? I'm
guessing that wasn't intended.





Sub SetFolderName() 'cell containing the offending \\ prefixed
foldername
FolderName = Sheets("Database").Range("FolderName").Value
End Sub

Hope this helps. At the moment, we're having to make sure that the
cell
"FolderName" contains something prefixed with a drive letter, which
is a bit
awkward, as not everyone maps o the folder in the same way.

Cheers

Pete



"Tim Williams" wrote:

Why not post the code? There *may* be something "wrong" with it if
it
does not work....
UNC paths have always worked fine for me in XL.

Tim