Help with Problem code needed

L

Les Stout

Hi, i have the code below that i have a problem with.

When i run it manually it works fine but always stops with "Code
execution has been interrupted" after loading the required file... Ther
are no breakpoints and it worked fine before ??

Sub testfileExists()
'
'
'Application.IgnoreRemoteRequests = True

If Dir("C:\gAMS_ZA-T-M\Reports\Downloads\Weekly_Report.xls") = "" Then
MsgBox "Sorry the file ""Weekly_Report.xls"" is not in the folder !!"
& vbCrLf & _
"" & vbCrLf & _
"Please generate a new report and save it to:-" & vbCrLf & _
"""C:\gAMS_ZA-T-M\Reports\Downloads\"" as
""Weekly_Report.xls""" & vbCrLf & _
"Then re-open this macro.", vbOKOnly + vbInformation, "Oops no
file !!"
Else
If (Now() -
filedatetime("C:\gAMS_ZA-T-M\Reports\Downloads\Weekly_Report.xls")) > 7
Then
MsgBox "The file you are going to process" & vbCrLf & _
"was created longer than 7 days ago !!" & vbCrLf & _
"& cannot be used ?", vbExclamation + vbOKOnly, "Warning
Old File"
chkWkbToClose
Else
ChDir "C:\gAMS_ZA-T-M\Reports\Downloads"
Workbooks.Open
Filename:="C:\gAMS_ZA-T-M\Reports\Downloads\Weekly_Report.xls"
RemoveRows'******** AT THIS POINT - ERROR *******
End If
End If
End Sub

'************ Format the header row *****************
Sub RemoveRows()


Les Stout
 
S

Susan

ChDir "C:\gAMS_ZA-T-M\Reports\Downloads"
Workbooks.Open
Filename:="C:\gAMS_ZA-T-M\Reports\Downloads\Weekly_Report.xls"
RemoveRows'******** AT THIS POINT - ERROR *******

i'm no expert but when i insert another sub to run within one, i have
to use

Call RemoveRows

but maybe somebody else will find something different.
susan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top