Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA code help needed | Excel Discussion (Misc queries) | |||
Code Help Needed | Excel Programming | |||
VB Code needed for Sorting with constraints problem-Tough One | Excel Programming | |||
VBA code Help needed | Excel Programming | |||
code needed | Excel Programming |