Thread: Saving File
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Richard Richard is offline
external usenet poster
 
Posts: 709
Default Saving File

Geoff,

I was trying to avoid that, as it isn't a path that everyone has mapped. Is
that the only reliable method?

Richard

"Geoff K" wrote:

Try an explicit path ??

strFilePath = "C:\atkams\Credit Lists\"

hth

Geoff K

"Richard" wrote:

Hi

If I save my file "manually", using File, Save As, I get no issue. If I try
saving with the following code:

Sub SaveFile()

Dim strFileName As String
Dim strFilePath As String
Dim strYear As String


strYear = Worksheets("Dates").range("PrevWrkDay")
strYear = Format(strYear, "yyyy")


strFileName = "European Exchange Volume " & strYear & ".xls"

strFilePath = "\\atkams\Credit Lists\"

application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=strFilePath & strFileName
application.DisplayAlerts = True

End Sub

I get run-time error '1004':
cannot access 'filename'

What am I doing wrong.

Thanks in advance
Richard