Mornign all,
My company is in the process of upgrading to 2007 so I am ensuring all macros run in 2007. So far most of them have. Howeer I am currently getting a runtime error when it get's to the saveas function.
Run-time error '1004':
Method 'SaveAs' of Object'_Workbook' failed
I have posted the code below. When I debug it it highlights the saveas feature.
Sub DBUpdate()
Dim FileDate As String
FileDate = Application.InputBox("Please enter file date: (MM/DD/YYYY)", _
"Enter Date", Format(Date - 1, "MM/DD/YYYY"))
If FileDate = "False" Then Exit Sub
Worksheets("UpdatingDB").Visible = xlSheetVisible
Sheets("UpdatingDB").Activate
Application.StatusBar = ("Please wait ... calculations in progress!!")
Application.Cursor = xlWait
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim c00 As String
Dim c01 As String
Dim MyArr As Variant
Dim MyArrCnt As Long
c00 = "\\wpccp001if\Apps\C3PO\PMG - Ben's\Network MPT Inclusion\ECMReports_Daily\"
c01 = c00 & Format((FileDate), "yyyymmdd")
MyArr = Array(" 224", " 223", " 222", " 221", " 215", " 214", " 213", " 212", " 211", " 210", " 205", " 204", " 203", " 202", " 201", " 200")
On Error Resume Next
Do
Workbooks.Add c00 & Dir(c01 & MyArr(MyArrCnt) & "*campdata.csv")
If Err.Number > 0 Then
Err.Number = 0
MyArrCnt = MyArrCnt + 1
Else
Exit Do
End If
If MyArrCnt > UBound(MyArr) Then
MsgBox "Campdata file not found. Please ensure file is available."
Application.ScreenUpdating = True
Sheets("Macros").Select
Application.Cursor = xlDefault
Application.StatusBar = False
Exit Sub
End If
Loop
On Error GoTo 0
ActiveWorkbook.SaveAs FileName:= _
"\\EMC-NAS4.nac.ad.aexp.com\Groups47\Fraud\Ops Desk\Reports and Trending\RCSN Data\campdata.xls", FileFormat:= _
xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
ActiveWorkbook.Close
Bookmarks