cplindem
12-14-2015, 03:29 PM
I am showing a userform with some settings in it to control the main portion of my code. This works properly. I wish to add a 2nd userform that will show a progress bar as the code runs. The problem is that this userform refuses to appear until the code is complete. It also is having trouble unloading.
First I simply show my menu:
Sub Format(control As IRibbonControl)
FormattingOptions.Show
End Sub
There is a Private Sub UserForm_Initialize(), but it basically just sets some values to combo boxes etc. Also in this menu, there is a button that calls:
Private Sub cmdFormat_Click()
'~~code that sets some public variables
Unload Me
Progress.Show 'userform does not appear until its initialize code has completed for some reason
'Unload Progress 'does not unload - causes "error 1004: that name is already taken"
End Sub
The Progress userform is intended to show an updating progress bar. But it refuses to appear at this point. It DOES however properly run the simple initialization code:
Private Sub UserForm_Initialize()
Call MainFormat
End Sub
The idea is that my MainFormat code will run and continuously update the progress bar. Then the Progress userform should close.
Public Sub MainFormat()
'~~a lot of code that manipulates some data
'Unload Progress 'causes error 91 on Progress.Show within Sub cmdFormat_Click()
End Sub
At this point the Progress userform finally appears. I don't understand why it doesn't appear when I first show it.
Also, as you may have noticed from my commented lines above, I have also tried to specify where the Progress userform should unload. Both location produce an error.
Any ideas?
First I simply show my menu:
Sub Format(control As IRibbonControl)
FormattingOptions.Show
End Sub
There is a Private Sub UserForm_Initialize(), but it basically just sets some values to combo boxes etc. Also in this menu, there is a button that calls:
Private Sub cmdFormat_Click()
'~~code that sets some public variables
Unload Me
Progress.Show 'userform does not appear until its initialize code has completed for some reason
'Unload Progress 'does not unload - causes "error 1004: that name is already taken"
End Sub
The Progress userform is intended to show an updating progress bar. But it refuses to appear at this point. It DOES however properly run the simple initialization code:
Private Sub UserForm_Initialize()
Call MainFormat
End Sub
The idea is that my MainFormat code will run and continuously update the progress bar. Then the Progress userform should close.
Public Sub MainFormat()
'~~a lot of code that manipulates some data
'Unload Progress 'causes error 91 on Progress.Show within Sub cmdFormat_Click()
End Sub
At this point the Progress userform finally appears. I don't understand why it doesn't appear when I first show it.
Also, as you may have noticed from my commented lines above, I have also tried to specify where the Progress userform should unload. Both location produce an error.
Any ideas?