Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro locks me in a single XLS file
Hello,
i have a macro that once every second reads all the rows in a worksheet, does some comparisons and when the comparisons have success it shows a simple form. [The data inside the sheet come from a DDE link in real time] The problem is that when this macro is running (it keeps running in loop with a 1 second pause [with a small loop with doevents] between each loop) i cannot switch to a different XLS file. Let me explain better... lets say that i have two XLS files open at the same time... they have their own "button" on the taskbar, clicking one of them i can switch from one XLS file to the other... Ok... this works... but NOT when the macro is running on the first XLS file. In some way, when i click on the taskbar button of the second XLS file, the focus goes back automatically to the first XLS file. Inside the same XLS file, thanx to the doevents, i have no restrictions... i can change worksheet, change cells, etc... all this while the Macro is running... the problem happens only when i have more than one XLS file open and want to switch to the other XLS file. Thanx, Luca |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro locks me in a single XLS file
You can't run two macros at the same time. I assume the button runs a macro
to make the switch. -- Regards, Tom Ogilvy "Luca T." wrote in message ... Hello, i have a macro that once every second reads all the rows in a worksheet, does some comparisons and when the comparisons have success it shows a simple form. [The data inside the sheet come from a DDE link in real time] The problem is that when this macro is running (it keeps running in loop with a 1 second pause [with a small loop with doevents] between each loop) i cannot switch to a different XLS file. Let me explain better... lets say that i have two XLS files open at the same time... they have their own "button" on the taskbar, clicking one of them i can switch from one XLS file to the other... Ok... this works... but NOT when the macro is running on the first XLS file. In some way, when i click on the taskbar button of the second XLS file, the focus goes back automatically to the first XLS file. Inside the same XLS file, thanx to the doevents, i have no restrictions... i can change worksheet, change cells, etc... all this while the Macro is running... the problem happens only when i have more than one XLS file open and want to switch to the other XLS file. Thanx, Luca |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro locks me in a single XLS file
Tom Ogilvy wrote:
You can't run two macros at the same time. I assume the button runs a macro to make the switch. Hmmm, i am not running two macros at the same time... i just cannot use two XLS files while the macro is running on one of them. The buttons are the the buttons on the taskbar (where every program has its own button). When you run two XLS files they are shown in the taskbar as two separated programs. Bye, Luca |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro locks me in a single XLS file
Do you activate any windows or workbooks or worksheets in your macro?
Anyway, using xl97 and using the window menu item, I could switch between workbooks with the following running Sub Runme() Dim i As Long Do For i = 1 To 1000 ThisWorkbook.Worksheets(1).Range("A5") = Rnd() DoEvents Next For i = 1 To 10000 DoEvents Next i Loop While True End Sub It was not real responsive and it didn't always work -my impression was if it I wasn't in the loop containing only doevents, then I couldn't switch - if I was, I could. -- Regards, Tom Ogilvy "Luca T." wrote in message ... Tom Ogilvy wrote: You can't run two macros at the same time. I assume the button runs a macro to make the switch. Hmmm, i am not running two macros at the same time... i just cannot use two XLS files while the macro is running on one of them. The buttons are the the buttons on the taskbar (where every program has its own button). When you run two XLS files they are shown in the taskbar as two separated programs. Bye, Luca |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro locks me in a single XLS file
Tom Ogilvy wrote:
Do you activate any windows or workbooks or worksheets in your macro? Hmmm no... what do you mean with "activate"? I only do stuff like what you did in the example below. Sub Runme() Dim i As Long Do For i = 1 To 1000 ThisWorkbook.Worksheets(1).Range("A5") = Rnd() DoEvents Next For i = 1 To 10000 DoEvents Next i Loop While True End Sub Unfortunately my Macro cannot always be in the doevents loop. :( Is there a way to open every XLS file with its own Excel instead than with one Excel as it is doing by default? Thanx, Luca |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro locks me in a single XLS file
I would just start a new instance of Excel and then do file=Open and open
the file I want. -- Regards, Tom Ogilvy "Luca T." wrote in message ... Tom Ogilvy wrote: Do you activate any windows or workbooks or worksheets in your macro? Hmmm no... what do you mean with "activate"? I only do stuff like what you did in the example below. Sub Runme() Dim i As Long Do For i = 1 To 1000 ThisWorkbook.Worksheets(1).Range("A5") = Rnd() DoEvents Next For i = 1 To 10000 DoEvents Next i Loop While True End Sub Unfortunately my Macro cannot always be in the doevents loop. :( Is there a way to open every XLS file with its own Excel instead than with one Excel as it is doing by default? Thanx, Luca |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving Excel file locks up all memory resources, accesses externalfile? | Excel Discussion (Misc queries) | |||
Save a single worksheet in Excel as a single file. | New Users to Excel | |||
calc locks up after running a macro that moves sheets to a new fil | Excel Discussion (Misc queries) | |||
file "save as" to floppy locks up | Excel Discussion (Misc queries) | |||
Excel data query locks source file | Excel Discussion (Misc queries) |