how to set answer = to command button

Jake975

Board Regular
Joined
Feb 9, 2020
Messages
114
Office Version
  1. 2016
Platform
  1. Windows
how do i get this code to wait for a command button click first?
VBA Code:
Sub ProcessnaTEST()
'Dim answer As NightAuditP.Button1.Caption
'answer = buttonText

Call intprogress

NightAuditP.Question.Caption = ("Are you ready to start the night audit file process?" & vbNewLine _
& "This is for the date of: " & Format(Date - 1, "mm-dd-yyyy"))
 
  If answer = Yes Then
'  Call PNT2
  MsgBox "Nihgt Audit Checklist printed"
  'Call pmtpause
  'Call Makefolder
  'Call FolderPicker
   ' Call Msgbox_1A
  ElseIf answer = vbNo Then
    MsgBox "Click Start prior to running audit in Opera when ready.", , "Night Audit Processing"
  Else
    'Call Reset
  End If
  End Sub
 
I have looked at your workbook and have a few notes regarding your implementation of the progress bar.
I feel that you understand how to apply it (technically). However, in general, you obviously do not want the dynamic display of a progress bar to seriously slow down the process you perform through VBA. In addition, it can be nice to remain flexible with regard to some procedures. What I have seen is that you have converted quite a few procedures to expect the mandatory arguments argUSF and argSteps when called. The MakeFolder and FolderPicker procedures are examples of this. This can be at the expense of flexibility (after all, only to be called with valid arguments from the userform) or readability of your code (to be called from anywhere with fake arguments, such as argUSF: = Nothing and argSteps: = 0).
Furthermore, I would recommend leaving the progress bar update code outside small For / Next loops, especially where worksheet ranges are addressed. In addition, this cannot be otherwise in procedures where several loops occur, after all how do you determine the total ratio of all three loops together in advance? In this regard, I refer to the example procedures TASK_Example_41 to 44.
So it's about making a well-considered decision about the places within your code wether to force an update of the progress bar or not. The right balance between performance, flexibly applicable and readable code and an informative gadget can often only be found by simply trying it out.
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
thank you so much for your time and feedback. This has been a long journey. And to think many of the things done with this workbook used to be done manually. There are so many different parts involved as you see and with this going to be deployed for business use you understand when i say it has to be "stupid proof". I really thank you for helping. I will defiantly keep you posted on the progress.
 
Upvote 0
You are welcome @Jake975, appreciate your feedback.
Btw making applications ? proof can be a real challenge sometimes :)
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,330
Members
453,032
Latest member
Pauh

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