Here is the code. This all worked fine until recently when my PC was upgraded to Windows XP. That may or may not be a coincidence. The code is below. I get to the debug statement "At 2" and then I get a MicroSoft Visual basic message: File not found:'C:\DOCUME~\FINNEG~1\LOCALS~1\Temp\VB27B.tmp'
Thanks for any help you can provide.
Kathleen
Sub SaveSheet()
Dim sFname As String
Dim TodayDate As String
'TodayDate = ""
' MsgBox "1- TodayDate is " & TodayDate
'TodayDate = Format(Now, "YYYY-MM-DD")
' MsgBox "2- TodayDate is " & TodayDate
sFname = ""
sFname = ActiveWorkbook.Path
MsgBox "ActiveWorkbook.Path is " & ActiveWorkbook.Path
Application.DisplayAlerts = False
MsgBox "At 1"
Sheets(1).Select
MsgBox "At 2"
Sheets(1).Copy
MsgBox "At 3"
sFname = ActiveWorkbook.Path
MsgBox "1 - sFname is " & sFname
sFname = sFname & "\Weekly Files\Factiva " & Format(Date, "yyyymmdd")
MsgBox "2 - sFname is " & sFname
MsgBox "At 4"
MsgBox "New File Name is " & sFname
MsgBox "Checking if File exists"
If FileExists(sFname) Then
MsgBox "Overwriting old file"
ActiveWorkbook.Save
Else
MsgBox "Creating New File "
ActiveWorkbook.SaveAs Filename:=sFname
End If
sFname = ""
End Sub
Thanks for any help you can provide.
Kathleen
Sub SaveSheet()
Dim sFname As String
Dim TodayDate As String
'TodayDate = ""
' MsgBox "1- TodayDate is " & TodayDate
'TodayDate = Format(Now, "YYYY-MM-DD")
' MsgBox "2- TodayDate is " & TodayDate
sFname = ""
sFname = ActiveWorkbook.Path
MsgBox "ActiveWorkbook.Path is " & ActiveWorkbook.Path
Application.DisplayAlerts = False
MsgBox "At 1"
Sheets(1).Select
MsgBox "At 2"
Sheets(1).Copy
MsgBox "At 3"
sFname = ActiveWorkbook.Path
MsgBox "1 - sFname is " & sFname
sFname = sFname & "\Weekly Files\Factiva " & Format(Date, "yyyymmdd")
MsgBox "2 - sFname is " & sFname
MsgBox "At 4"
MsgBox "New File Name is " & sFname
MsgBox "Checking if File exists"
If FileExists(sFname) Then
MsgBox "Overwriting old file"
ActiveWorkbook.Save
Else
MsgBox "Creating New File "
ActiveWorkbook.SaveAs Filename:=sFname
End If
sFname = ""
End Sub