Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 652091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:14:02+00:00 2026-05-13T22:14:02+00:00

I hope this is a relatively easy problem although I have spent hours websearching

  • 0

I hope this is a relatively easy problem although I have spent hours websearching and using T&E to no avail. Hopefully someone can help ;o)

I have an excel module that shows a UserForm to get some input data before doing a lot of processing. At the bottom of the userform are a couple of command buttons labeled “OK” and Cancel”. I need to be able to have the user change option buttons then click on OK or Cancel to exit, where my module will continue the process based on whether or not “Cancel” was pressed. I just can’t seem to find a way to read a Boolean result from pressing the Cancel button on the form. I’m 99% sure it’s some kind of Public / Private referencing error, but I haven’t earned enough experience to figure it out yet. Here is the code snippets:


(From Module1)

Sub ModuleName()

Dim State as Boolean
' Display Parameter box
UserForm2.Show
If UserForm2.ButtonCancel Then
    State = True
Else
    State = False
End If

End Sub

Based on the True or False from the Cancel, I can drive the rest of the procedure.


(UserForm2 Code)

Private Sub ButtonCancel_Click()

 BtnCancel = True

Unload Me

End Sub

Private Sub ButtonOK_Click()

 BtnCancel = False

Unload Me

End Sub


Private Sub ButtonReset_Click()

'Set the Default Settings

NEAlias.Value = "True"

NoteIgnore.Value = "True"

ABIgnore.Value = "True"

LinkIgnore.Value = "True"

End Sub

Private Sub UserForm_Initialize()

Dim BtnCancel As Boolean

'Add the Text to the options

NEIgnore.Caption = "Ignore"

NoteIgnore.Caption = "Ignore"

ABIgnore.Caption = "Ignore"

LinkIgnore.Caption = "Ignore"

NEAlias.Caption = "Alias Only"

NoteAlias.Caption = "Alias Only"

ABAlias.Caption = "Alias Only"

LinkAlias.Caption = "Alias Only"

NEMove.Caption = "Move and Alias"

NoteMove.Caption = "Move and Alias"

ABMove.Caption = "Move and Alias"

LinkMove.Caption = "Move and Alias"

'Set the Default Settings

NEAlias.Value = "True"

NoteIgnore.Value = "True"

ABIgnore.Value = "True"

LinkIgnore.Value = "True"

End Sub

That’s it. It looks like it should be simple but I’m stumped. TIA for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:14:02+00:00Added an answer on May 13, 2026 at 10:14 pm

    [SOLVED]
    I finally figured ti out. I just needed this statement in the Declarations Section of Module1:

    Public BtnCancel As Boolean

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope this is an easy one. Using MVC4 with Entity Framework 4.1. I'am
hope this will be a quick easy question, I've just tried my app on
I hope this question isn't too dumb. We have many websites internally that need
I have a problem with a relatively simple query and the execution plan Access
I hope this is a relatively straight forward thing to do, and that my
Hopefully this is relatively simple. After I perform a LINQ query on a DataTable
I'm relatively new to jquery, so I have what I hope will be a
I'm relatively new to Java, so I hope this isn't a dumb question. I
I have what I hope is a relatively simple request. I am working on
I'm relatively new to web application programming so I hope this question isn't too

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.