Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stops executing or keep looping
Application.EnableEvents = False
workbooks.Open "c:\mydocs\myfile.xls" Application.EnableEvents = True -- Regards, Tom Ogilvy Kenji wrote in message ... Dear Don, Foremost, thank you for responding to my question. I think I was not clear about my question, however. Let's assume that myfile.xls contains macro and all sort of junks. It certainly opens myfile.xls, but it stops there. It won't go to the next instruction. I'm guessing that it has an open event and exits the subroutine(?). What I would like to do is somehow open myfile.xls by disabling macro first. Do you have any suggestion? Thanks again. "Don Guillett" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stops executing or keep looping
It worked. Thanks.
"Tom Ogilvy" wrote in message ... Application.EnableEvents = False workbooks.Open "c:\mydocs\myfile.xls" Application.EnableEvents = True -- Regards, Tom Ogilvy Kenji wrote in message ... Dear Don, Foremost, thank you for responding to my question. I think I was not clear about my question, however. Let's assume that myfile.xls contains macro and all sort of junks. It certainly opens myfile.xls, but it stops there. It won't go to the next instruction. I'm guessing that it has an open event and exits the subroutine(?). What I would like to do is somehow open myfile.xls by disabling macro first. Do you have any suggestion? Thanks again. "Don Guillett" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why are my functions not executing? | Excel Worksheet Functions | |||
EXECUTING A FORMULA | New Users to Excel | |||
executing a macro within another | Excel Discussion (Misc queries) | |||
Executing Macros | Excel Discussion (Misc queries) | |||
Forumlas Not Executing | Excel Discussion (Misc queries) |