makeitwork09
Technical User
I am using Microsoft 2007 in Compatibility Mode
The above code was working fine until I added and executed the code below
Now that the above code has been executed, while testing the code, the
first subroutine returns the following error
Application defined or object-defined error
I tried setting
to ws as
Worksheet variable and breaking out
to
but got the following error when I did that
Method range of object_worksheet
Any assitance is much appreciated
Code:
Sub HandlePreviousRecords()
Dim answer As String
answer = MsgBox("Running this will delete the prior records. Do you
want to continue?", Buttons:=vbYesNo + vbQuestion)
If answer = vbYes Then
Workbooks("compass_test.xls").Worksheets("COMPASS").Range("A1",
ActiveCell.SpecialCells(xlLastCell)).Clear
'delete the old records
Call CompassQT
End If
End Sub
The above code was working fine until I added and executed the code below
Code:
Sub saveCompassFeed()
'
' saveCompassFeed Macro
' This macro copies the contents of the COMPASS tab to the designated
folder on the network drive
'
' Keyboard Shortcut: Ctrl+s
'
Dim FD As String 'From date
FD = Format(Range("accounting_date").Value, "mm_dd_yyyy") & " DATA" &
Format(Now(), "mm dd yyyy hh mm AMPM")
'Copy worksheet
Application.ScreenUpdating = False
Dim wb As Workbook
Dim NewShtName As String
NewShtName = "COMPASS " & FD
Workbooks("compass_test.xls").Worksheets("COMPASS").Copy
Set wb = ActiveWorkbook
wb.Worksheets("COMPASS").Name = NewShtName
' from [URL unfurl="true"]http://www.ozgrid.com/forum/showthread.php?t=65552[/URL]
ActiveWorkbook.SaveAs Filename:="\\Real-Estate\Reports\" & _
"COMPASS " & FD, FileFormat:=xlNormal, Password:="", _
WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
MsgBox "A file was created and saved on S:STAFF - vol_1\INVEST\Reports
as " & NewShtName, , "File Successfully Saved"
Application.ScreenUpdating = True
End Sub
Now that the above code has been executed, while testing the code, the
first subroutine returns the following error
Application defined or object-defined error
I tried setting
Code:
Workbooks("compass_test.xls").Worksheets("COMPASS")
Worksheet variable and breaking out
Code:
Workbooks("compass_test.xls").Worksheets("COMPASS").Range("A1",
ActiveCell.SpecialCells(xlLastCell)).Clear
to
Code:
set wsInitial = Workbooks("compass_test.xls").Worksheets("COMPASS")
wsInitial..Range("A1", ActiveCell.SpecialCells(xlLastCell)).Clear
but got the following error when I did that
Method range of object_worksheet
Any assitance is much appreciated