+ Reply to Thread
Results 1 to 5 of 5

VBA To Launch And Complete Workbook

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    70

    VBA To Launch And Complete Workbook

    I'm nearing the end of my project and I have a few outstanding code queries if anyone could spare a little time to help me resolve them.

    I have attached a dummy workbook and would like to know (if it's possible) how to do the following:
    • Submit Button automatically opens form "example" in a seperate workbook and completes nominated Cells if the "Launch Test Form"check box is ticked. (eg, fields 1, 3, 6 to fill cells in Workbook "Example" A1, C12, H14 Respectively)
    • Userform automatically saves and close when Submit is pressed.
    • Cannot be closed with X (or clicking x closes aplication as well as form)

    Many thanks in anticipation of any help that may result. I am online all the time to answer any queries.

    (Password for form "Unlock" is 12345)
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-08-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: VBA To Launch And Complete Workbook

    Friendly bump just in case some fresh eyes catch it!

  3. #3
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: VBA To Launch And Complete Workbook

    Of the top of my head for the saves and close when subit is met, have all your code that might write to a sheet first then at the bottom so it reads it last you need something to call a sub, ie call force save then code off top of my head might be like

    Please Login or Register  to view this content.

    this might give you an idea, but you call that sub in your submit click then the close would be an unload me etc after that

  4. #4
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: VBA To Launch And Complete Workbook

    for your last question add this code to you user form module:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-08-2011
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: VBA To Launch And Complete Workbook

    Quote Originally Posted by kieranbop View Post
    Of the top of my head for the saves and close when subit is met, have all your code that might write to a sheet first then at the bottom so it reads it last you need something to call a sub, ie call force save then code off top of my head might be like


    this might give you an idea, but you call that sub in your submit click then the close would be an unload me etc after that

    Thanks for that, but how would I insert a sub in a sub?

    I have a similar problem with another piece of code I'm using to launch the second workbook:

    [code]
    Private Sub ChkCorrection_Click()
    Workbooks.Open FileName:= _
    "filename and path"
    Windows("Real.xlsm").Activate
    End Sub
    [End Sub]

    If I attach the code to a command button and click the button, the form launces as requested, but when I assign the code to a tick box, I cannot figure out where to put the code. Logic would say it should go somewhere before the unload command in the Submit Button code, but I can't figure out how to make it work.

    Any suggestions would be most welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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