Code Breaking/Pausing When .Show Command is used

leisim98

New Member
Joined
Sep 18, 2008
Messages
4
<o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"></o:smarttagtype><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]><object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> Hi <!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" alt="" style='width:12pt; height:12pt'> <v:imagedata src="file:///C:\DOCUME~1\nzbls\LOCALS~1\Temp\msohtml1\01\clip_image001.gif" o:href="http://www.mrexcel.com/forum/images/smilies/biggrin.gif"/> </v:shape><![endif]--><!--[if !vml]-->:biggrin:

Since I used this code....

Private Sub Workbook_Open()
Sheets("Input").Select
Mode.Show
End Sub

...to open the GUI on the launch of the workbook, my VBA program pauses bringing up the visual basic window.

The code resumes as normal after I press continue or F5.

This is a major problem though because it slows the code drastically. I had had the problem intermittently before I wrote the above code into the ThisWorkbook module but now it is persistent.

The only places the code pauses is where the .Show command is used both in the code shown above and when another UserForm is opened.

I’m using VBA in excel 2002 SP-2 and Windows XP

Any help would be greatly appreciated.

Regards

<st1:place>Leith </st1:place><!--[if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" alt="" style='width:12pt;height:12pt'> <v:imagedata src="file:///C:\DOCUME~1\nzbls\LOCALS~1\Temp\msohtml1\01\clip_image001.gif" o:href="http://www.mrexcel.com/forum/images/smilies/biggrin.gif"/> </v:shape><![endif]--><!--[if !vml]-->:biggrin:<!--[endif]-->
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
:):):)

I think I solved the problem myself now. It was that the Userform was already open. Or something like that.

I removed a few unload me's and a few userform.show's and the problem seems to be fixed.

Thanks
 
Upvote 0
I think that part of the problem is that the Open event happens before the workbook is visible. You may want to move that to the Workbook_Activate event.

When you are having problems when another UF is open, is the sequence:

Mode.Show
Mode.Hide
otherUserform.Show
Mode.Show

or is Mode not loaded when otherUserform is .Shown?

Is the Mode modeless or a modal userform?
And is otherUserform modal or modeless?
 
Upvote 0
Wow now im confused.

Whats is Model and Modeless?

The sequence is sort of what you have put, of course with alot of logic in between.
 
Upvote 0
Wow now im confused.

Whats is Model and Modeless?

The sequence is sort of what you have put, of course with alot of logic in between.

Read up in the help files about modal (not model)... you can toggle modal true or false in the userform properties. One, essentially, allows you to work in the worksheet and one does not while the userform is visible.
 
Upvote 0

Forum statistics

Threads
1,224,922
Messages
6,181,783
Members
453,065
Latest member
jfrsanders

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top