Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Excel Macro; Okay before Windows XP installed

Status
Not open for further replies.

KBFINN

Programmer
Nov 18, 2002
9
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top