Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Its just stopping??????

Status
Not open for further replies.

FunkMaster

Technical User
Aug 1, 2002
26
GB
Hello All

Okay the problem is that we got an bit of an hefty script that, opens an programs runs it saves results and sends it to excel and it carries out some filter stuff. Now the problem is that while running for no appranent reason the running will just stop. i have had task manger open and its not me resoucers i looked over the script and we can run it again from where it stopped so its not that. so my question is why does it stop ? and how can i stop it stopping?

Cheers

The Tea-Boy
 
More info pleas - what "stuff" does it do ??
Id it all in one app or are other apps called ???
Does it always stop on the same line ??
If so, which one ??
etc etc Rgds
Geoff

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
 
cheers xlbo for replying.
The bit of code it stopping on is this bit
Sub Billinging()

Application.Interactive = False
Application.DisplayAlerts = False

Dim LoadCells As New Collection
Dim cell As Range

For Each cell In Range(Cells(2, 2), Cells(40, 2))
If Not IsEmpty(cell) Then
LoadCells.Add Item:=cell.Value
End If
Next

Dim x
For Each x In LoadCells
Workbooks.OpenText FileName:="C:\billing\results\text\BOMO083_INV1.txt"
Selection.AutoFilter Field:=2, Criteria1:=x
ActiveSheet.Cells.Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.SaveAs FileName:= _
"C:\Billing\results\excel files\BOMO083_" & x & "", FileFormat:=xlNormal
ActiveWindow.Close
ActiveWorkbook.Close
Next
...............................
..............
.....
Application.Interactive = True
Application.DisplayAlerts = True

End Sub

the rest of the sub is the same as the bit that opens the text document and filters it by x , copys and pastes it to another workbook and saves it as an excel document. The bit of code it stops on is always during this sub , its random which bit of the sub t stops. but comes up with no error messages and such. the rest of the script deals with business objects and access. During this part its not used. soo any ideas?

Cheers Wayne 5% is not an rise, its an poke in the eye.
 
because you have application.displayalerts = false, this may well be masking any error alerters if not the error messages themselves. suggest you comment out this line and step thru the code to see what it throws up

As for app interactive - I've never seen this used within an excel macro - only really in B/O - from the help, it should block any entries from mouse or keyboard but if there is a bug, it may be blocking some code instructions as well. suggest you comment out both lines and see what happens then. Apart from that, I can't really see any probs with that code. If you are calling other apps before or after, it may be having an impact tho. Have you tried running this as a stand alone sub with test data and seeing if it runs thru ?? Rgds
Geoff

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
 
cheers

Yeah ran it on its own and it runs okay. maybe the the computer. not sure thanks for your help, i will comment the line out check it through again. more strange was that it ran fine an couple of months ago. oh well

cheers again

wayne 5% is not an rise, its an poke in the eye.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top