View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default If Macro Run From Form Control Button/Shape, "Find" Command Not Working

KeriM;1618609 Wrote:
I know that. I'm not trying to execute another macro while a macro
is running. I'm pausing the current macro to manually do a find
(ctrl + F) on another sheet in the workbook to fill in data gaps due
to data entry errors and then continue the macro that I paused.

For some reason, when the macro is initiated by a button press, the
"find" does not search the whole workbook and only searches the
currently selected cell. If I initiate the macro within the VBA
window, this does not happen. What I want to know is why.


'GS[_2_ Wrote:
;1618612'] 'GS[_2_ Wrote: --
;1618581'] Code:--
--------------------

Sub Test()
Stop
End Sub

--------------------


At the "Stop" is when I'd try to do a find on the workbook while
the report was still running the macro.--

You can't execute another macro via the UI so as to interupt code
that is already executing. You have to wait for it to finish.

What you can do is prompt the user for 'Find' criteria and have
the running code process that.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion-

I know that. I'm not trying to execute another macro while a macro
is running. I'm pausing the current macro to manually do a find
(ctrl + F) on another sheet in the workbook to fill in data gaps
due to data entry errors and then continue the macro that I
paused.

For some reason, when the macro is initiated by a button press, the
"find" does not search the whole workbook and only searches the
currently selected cell. If I initiate the macro within the VBA
window, this does not happen. What I want to know is why.-


While code is "in play", Excel usually forbids any interaction until
that code "ends" -OR- the code itself prompts the user for
interactive input via an appropriate method.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Garry,

That is usually correct, but I am able to interact with the program
when the code pauses at a "stop" command. I know this works because
I can do it when I don't initialize the macro with the button. I'm
not questing whether or not it will or should work, because I know it
does since I've been doing it without the button for a few months now
with no issues. Something different happens when I click the button
vs just running the macro directly from the VBA window.


There are some different behaviors when using 'Debug' mode, but even
that disables Excel's menus/keys. Show your actual macro with commented
'stop' point and action to take while stopped...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion