+ Reply to Thread
Results 1 to 5 of 5

VB Code to Show User Form so it can be checked then go to Module to run addtional code

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Lake Elsinore
    MS-Off Ver
    Excel 2010
    Posts
    46

    VB Code to Show User Form so it can be checked then go to Module to run addtional code

    Hello All,

    I'm trying to figure out how to write code to do the following AFTER a Button is selected on an Excel Spreadsheet (NOTE: the button on the Excel Spreadsheet is currently assigned to the Macro Name: Customer_Prep_Email)

    1.) Open UserForm1 (a check box with a comment is on the form) and allow the user to check the box
    2.) After the the Checkbox is selected, I would like to have the button disappear from the Excel Spreadsheet
    3.) Once the box has been checked - go to the module and run the code that I have there.

    Below is the current code that I have, the problem is that I can't get the UserForm1 to pop-up and allow the user to check the box. I originally had code to show the UserForm1 and allow the user to check the box, but then couldn't get it to run the rest of the code:

    CODE WITHIN THE UserForm1:

    Please Login or Register  to view this content.
    Private Sub Checkbox1_Click() 'If not Checkbox 1, change to appropriate index number in title and elsewhere in the code.
    If Me.CheckBox1.Value = True Then
    Customer_PO_Acknowledgement
    End If
    End Sub
    Please Login or Register  to view this content.

    CODE WITHIN THE Module1

    Please Login or Register  to view this content.
    'Sub Customer_PO_Acknowledgement()

    'UserForm1.Show


    Sub Customer_Prep_Email()

    Sheets("SWPO").Copy

    filenam = "C:\Customer Purchase Order Form" & Range("F4") & ("_") & Range("C5") & (" ") & Range("F5") & ("_") & Format(Now(), "mmddyy") & ".xlsm"

    ActiveSheet.Shapes.SelectAll
    Selection.Delete
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    ActiveWorkbook.Protect Structure:=True, Windows:=False
    ActiveWorkbook.SaveAs Filename:=filenam, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    Application.Dialogs(xlDialogSendMail).Show
    ActiveWorkbook.Close

    Windows("Customer Purchase order Form.xlsm").Activate

    End Sub
    Please Login or Register  to view this content.
    If it's possible, I would also like to create the document to be converted to a PDF before saving it and then saving it as PDF and emailing a PDF Document.

    I WOULD GREATLY appreaciate any help with this issue, I've been searching and trying differnt code for a few days now. I'm not strong with VB code but need it to accomplish my task.

    Thank you, in advance, for your assistance.
    Last edited by tcrjmom; 09-03-2014 at 03:12 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VB Code to Show User Form so it can be checked then go to Module to run addtional code

    CODE WITHIN THE Module1

    Please Login or Register  to view this content.
    you have to eliminate char ' and add end sub
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: VB Code to Show User Form so it can be checked then go to Module to run addtional code

    Hi, tcrjmom,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    10-11-2012
    Location
    Lake Elsinore
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: VB Code to Show User Form so it can be checked then go to Module to run addtional code

    OK thank you HaHoBe,

    I apologize for the error and have edited the post as you have requested.

    thank you.

  5. #5
    Registered User
    Join Date
    10-11-2012
    Location
    Lake Elsinore
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: VB Code to Show User Form so it can be checked then go to Module to run addtional code

    Hello Patel45,

    Thank you for your response; however, the code above does not allow for the UserForm1 box appear which is where the Checkbox is that needs to be checked by the user.

    the Checkbox is a verification that the user has to confirm that they've read the agreement and by clicking they acknowledge it. I need the code to not run unless the box is checked by the user.

    Regards,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Delete Form, Module and This Workbook code (Run Once)
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-15-2014, 12:11 PM
  2. Help with Code for User Form
    By Kristine T. in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-15-2009, 06:33 AM
  3. how to access Sheet module, normal module, Worbook module to type code
    By alibaba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2009, 07:51 AM
  4. Which User Form Listbox selection just checked?
    By Don Wiss in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2005, 09:05 PM
  5. Replies: 1
    Last Post: 04-10-2005, 07:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1