ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Problem code needed (https://www.excelbanter.com/excel-programming/375307-help-problem-code-needed.html)

Les Stout[_2_]

Help with Problem code needed
 
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

*** Sent via Developersdex http://www.developersdex.com ***

Susan

Help with Problem code needed
 
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


Les[_8_]

Help with Problem code needed
 
Hi Susan, thanks for the reply, i tried that too but with no success
though.


Susan wrote:
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




All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com