Stops executing or keep looping
I generally use the simple approach. See if this works.
Sub Main()
Workbooks.Open Filename:="myfile.xls"
Call Var1
Call Var2
Call Var3
End Sub
"Kenji" wrote in message
...
Some how, either stops in middle of codes or keep looping.
I don't know how to overcome this.
All these are in Module1.
The below is not an actual code, but structure is like so.
Here are my problems with VBA:
1. If "myfile.xls" contains some kind of macros, it stops program after
the file is opened. If I step through, it will go back to "Sub Main()"
because it never goes to the next instruction (Call Procedure(Var1)).
Stepping through will cause looping because it never goes to End Sub.
2. Similar to #1, but after executing "Call Procedure(Var1)", the program
will not go to the next instruction.. If I step through, at the end of
Call
Procedure(Var1), it goes back to Sub Main() again.
Both situations do not cause any errors.
If anyone can help me some possibilties or give me some tips on how to
prevent this, I would really appreciate it.
Thanks.
Sub Main()
Dim Var1 As Integer, Var2 As Integer, Var3 as Integer
Workbooks.Open Filename:="myfile.xls"
Call Procedure(Var1)
Call Procedure(Var2)
Call Procedure(Var3)
End Sub
|