ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form (https://www.excelbanter.com/excel-programming/420697-user-form.html)

Sri via OfficeKB.com

User Form
 
Hello all

I am writing a VB macro in XL which has 5 major phases. I would like to
display a user form to the user when the macro begins to execute. This user
form will have the list of my 5 phases and a check box before each phase. At
the beginning, all the 5 boxes will be unchecked, indicating that none of the
phases completed. Once a particular phase finishes, I would like to tick the
checkbox corresponding to this phase. This will clearly give an indication to
the user what the macro is doing.

I use the following code but not working. Control stops after displaying the
ApplicationStatus (user form) and not moving to next statements until I close
the user form. Any help please€¦

My requirement is to continue execution of the macro, keeping this user form
displayed.

Regards
Sri

Sub MainMacro()

ApplicationStatus.CheckBox1.Value = 1
ApplicationStatus.CheckBox2.Value = 0
ApplicationStatus.CheckBox3.Value = 0
ApplicationStatus.CheckBox4.Value = 0
ApplicationStatus.CheckBox5.Value = 0
ApplicationStatus.Show

€˜Beginning of phase 1
Command 1 €¦
Command 2 €¦
Command 3 €¦
€˜End of phase 1

Unload ApplicationStatus
ApplicationStatus.CheckBox1.Value = 1
ApplicationStatus.CheckBox2.Value = 1
ApplicationStatus.CheckBox3.Value = 0
ApplicationStatus.CheckBox4.Value = 0
ApplicationStatus.CheckBox5.Value = 0
ApplicationStatus.Show

€˜Beginning of phase 2
Command 1 €¦
Command 2 €¦
Command 3 €¦
€˜End of phase 2

etc€¦. etc€¦.

End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200812/1


Office_Novice

User Form
 
Option Explicit

Private Sub UserForm_Activate()
Call CheckStatus(1)
'Do Phase 1
Call CheckStatus(2)
'Do phase 2
'And So on

End Sub

Function CheckStatus(i As Long)
If i = 1 Then UserForm1.CheckBox1.Value = True
If i = 2 Then UserForm1.CheckBox2.Value = True
If i = 3 Then UserForm1.CheckBox3.Value = True
If i = 4 Then UserForm1.CheckBox4.Value = True
If i = 5 Then UserForm1.CheckBox5.Value = True
End Function


"Sri via OfficeKB.com" wrote:

Hello all

I am writing a VB macro in XL which has 5 major phases. I would like to
display a user form to the user when the macro begins to execute. This user
form will have the list of my 5 phases and a check box before each phase. At
the beginning, all the 5 boxes will be unchecked, indicating that none of the
phases completed. Once a particular phase finishes, I would like to tick the
checkbox corresponding to this phase. This will clearly give an indication to
the user what the macro is doing.

I use the following code but not working. Control stops after displaying the
ApplicationStatus (user form) and not moving to next statements until I close
the user form. Any help please€¦

My requirement is to continue execution of the macro, keeping this user form
displayed.

Regards
Sri

Sub MainMacro()

ApplicationStatus.CheckBox1.Value = 1
ApplicationStatus.CheckBox2.Value = 0
ApplicationStatus.CheckBox3.Value = 0
ApplicationStatus.CheckBox4.Value = 0
ApplicationStatus.CheckBox5.Value = 0
ApplicationStatus.Show

€˜Beginning of phase 1
Command 1 €¦
Command 2 €¦
Command 3 €¦
€˜End of phase 1

Unload ApplicationStatus
ApplicationStatus.CheckBox1.Value = 1
ApplicationStatus.CheckBox2.Value = 1
ApplicationStatus.CheckBox3.Value = 0
ApplicationStatus.CheckBox4.Value = 0
ApplicationStatus.CheckBox5.Value = 0
ApplicationStatus.Show

€˜Beginning of phase 2
Command 1 €¦
Command 2 €¦
Command 3 €¦
€˜End of phase 2

etc€¦. etc€¦.

End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200812/1



Sri via OfficeKB.com

User Form
 
Thank you friend. Thank you for your reply.

Office_Novice wrote:
Option Explicit

Private Sub UserForm_Activate()
Call CheckStatus(1)
'Do Phase 1
Call CheckStatus(2)
'Do phase 2
'And So on

End Sub

Function CheckStatus(i As Long)
If i = 1 Then UserForm1.CheckBox1.Value = True
If i = 2 Then UserForm1.CheckBox2.Value = True
If i = 3 Then UserForm1.CheckBox3.Value = True
If i = 4 Then UserForm1.CheckBox4.Value = True
If i = 5 Then UserForm1.CheckBox5.Value = True
End Function

Hello all

[quoted text clipped - 48 lines]

End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200812/1



All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com