PDA

View Full Version : [SOLVED] UserForm Running - While Jumping to Application GoTo Statement - Unload



dj44
06-10-2017, 06:10 PM
folks,

good evening,

I thought i would work a bit on my userform its been stuck for a while.

I cant figure out what the problem is.

I used application go to to go to the location of the macro

But the userform is still running and wont let me edit in the module.

I just want to go to the module - Yes it does that , but the userform is still running so i cant do anything - unless i close the userform

if i close the userform i lose my location that i jumped to




Private Sub CommandButton1_Click()


'Go to the macro place in the module macros

With Application
.Goto ListBox1.Column(1)
End With
Unload Me ' <<< this wont let me go to the module

End Sub


what can i use to stop the userform running while i jump to the module

its not very clear what i mean but you can see form the userform

I have attached the offending culprit here

thank you for your advice

Paul_Hossler
06-10-2017, 06:52 PM
Try this in the user form code




Private Sub CommandButton1_Click()

sMacroToRun = ListBox1.Column(1)

Me.Hide

With Application
.Run sMacroToRun
End With

Unload Me

End Sub


with this in the Macros module



Option Explicit

Public sMacroToRun As String


Sub UF_Show()
UFListBox.Show
End Sub

dj44
06-10-2017, 07:33 PM
Hello Paul,

good weekend

I forgot about the hide.me

Becuase i was using unload me.

The reason i was using application goto is so that I can also navigate to the Module Macros and go to that sub procedure - so i can inspect it



is there a way of opening the Module to that Sub.

For example how would i go to

myTestMacro23 in the code module

Normally i use application GOTO and it jumps there, but with the userform - I dont know it doesnt like to do that well it does but it still runs

i hope i made some modicum of sence

Paul_Hossler
06-10-2017, 07:40 PM
Not sure about


so that I can also navigate to the Module Macros and go to that sub procedure - so i can inspect it

I usually use F9 to put a breakpoint on the appropriate line so that the macro stops there and then I can single step through it

19462

dj44
06-10-2017, 07:41 PM
Hello Paul,

Actually I think it worked

it went to the location and the userform stopped runnning





Private Sub CommandButton1_Click()

sMacroToRun = ListBox1.Column(1)

Me.Hide


With Application
.Goto ListBox1.Column(1)
End With
'Unload Me

End Sub



No unload me at the end, and it wasnt running as before.

Let me fiddle in case i run into somehting again

dj44
06-10-2017, 07:48 PM
This did perplex me into a corner - the userform previously kept running with no instructions from me to do so what so ever,
i thought code was meant to be very explicit with the instructions
well it always fails to follow mine even when i tell it so :grinhalo:

Well Im making some progress on my userform project

I'll be finished in another million years me thinks..

but its all learning good fun untill I break the array and i cant find my missing declaration

but..i'll keep on keep on...

thanks Paul

good weekend all

Paul_Hossler
06-10-2017, 07:49 PM
OK, but try putting a breakpoint on the Run line (F9) and use F8 single step instead of the GoTo instead