+ Reply to Thread
Results 1 to 10 of 10

Wanna make a Userform Close and Save - Then open a different workbook?

  1. #1
    Registered User
    Join Date
    11-28-2012
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    8

    Wanna make a Userform Close and Save - Then open a different workbook?

    Hi guys.

    Ok so my problem is pretty much what it says in thread title. I have a workbook (WB1) that needs to be read only. Its going to be used by lots of people so don't want them messing things up. But some of the sheets in WB1, users will enter data on via a userform - So on WB1 I have a button with a link to the data sheet which is not read only (WB2). I have created the Userform and the code to populate the data onto WB2, it then saves and closes the sheet (WB2). But I want it to then take them back to WB1 - So that it seemlesly seems to anyone else that they never left the read only sheet to begin with....Does that make sense?

    Here is the code I have so far:

    Please Login or Register  to view this content.
    What (if anything) can I do to make WB1 open after clicking submit on the userform to save and close WB2?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    Which workbook is the userform in?

    If it's WB1 surely the workbook is already open.

    What does your current code do/not do?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-28-2012
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    Userform is in WB2 - And i guess WB1 would still be open either way. The thing is for my purposes I wouldnt need to do any of this. The only reason i DO need to do it is coz around 100 of my collegues are going to be using this and well...although i dont have a lot of VBA/Excel experience, I know that when sharing a sheet to the masses, somebody always knackers it up.

    WB1 is a communications and guidance hub containing lots of links to intranet pages, internal guidance notes and all sorts which is why I want it read only to protect the sheet being corrupted by 'Joey No IT Skills'? The sheet with the Userform and where the date gets writtin too is a Questions and answers sheet...userform lets them add the date their name and their question - again so that they dont have to meddle and mess stuff up (formatting, formula etc)....I guess im not making a lot of sense?

    oh and my code works great so far - will copy the textbox entries to the sheet (WB2) saves it and closes it - what it doesnt do is then go back to WB1. It needs to close WB2 after question submitted coz then it "locks everyone else out for editting". Am i over thinking this?

    Edit: Just re read my message back again and I just want to clarify that because of the read only issue - I then instead decided to have the data be posted to an new workbook which is what WB2 is - so to clarify the data is not being sent to WB1 anymore its going to WB2 so that I can have WB1 read only and WB2 Write enabled to allow the userform to write the data.
    Last edited by Wanting2Excel; 12-06-2012 at 05:04 PM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    I'm a little confused, how are the workbooks connected?

    Also, have you tried opening WB1 before you close WB2

  5. #5
    Registered User
    Join Date
    11-28-2012
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    I apologise, I'm pretty new to this and don't quite know how to put it

    basically WB1 is a hub for pretty much everything we use during our day to day work. Guidance, information, stats etc. Coz it's going to be used by so many and people using it all day long I want them to have as little access to formatting and well, anything other than the cells they need to use really. Thats why WB1 needs to be r-only. But if WB1 r-only then stops people adding information coz then they cant save it. So I set up WB2 - formatted it to look exactly like WB1 end left that right enabled. So that when a user clicks on the button for the userform it takes them to WB2 where the userform then pastes the data.

    Im probablly going the wrong way about it - Is it possible to have a wb read only but have certain sheets or cells open so that the Userform can do its thing?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    Sorry I'm totally lost here.

    You have WB1 which is the 'hub', is that where the userform is opened from? Is WB2 opened at the same time?

    What thing do you want the userform to do?

    I thought it was putting data in WB2 which wasn't read only.

    It sounds to me that you already have WB1 open so all you need to do is close WB2.

  7. #7
    Registered User
    Join Date
    11-28-2012
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    Trying to get it as 'automated' as possible.

    WB1 has a button which opens up WB2. WB2 has a question and answers table on sheet1. A button at the top of the table opens the Userform. Userform pastes date name and question to table in sheet1 and then saves WB2 and closes WB2. Yes WB1 would remain open the whole time but I want to somehow guarantee that once WB2 has saved and closed that it goes straight back to WB1 (I.e if there are also other workbooks open in the same instance of excel then I dont want it to go to one of those pages instead)

    I guess there is probably a much simpler way of achieving my aim but this is just the only way I can think of to protect the sheets in WB1 (the hub) with read only and have a sheet that can have data inserted and saved.
    Last edited by Wanting2Excel; 12-06-2012 at 07:33 PM.

  8. #8
    Registered User
    Join Date
    07-08-2012
    Location
    Melbourne Australia
    MS-Off Ver
    Excel 2003
    Posts
    79

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    if everything works and all your wanting is to return to WB1

    maybe chuck this in at the start

    Please Login or Register  to view this content.
    and this at the end to take you back

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-28-2012
    Location
    Manchester
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    Quote Originally Posted by gwsampso View Post
    if everything works and all your wanting is to return to WB1

    maybe chuck this in at the start

    Please Login or Register  to view this content.
    and this at the end to take you back

    Please Login or Register  to view this content.
    The WB1.Activate bit alone did exactly what I wanted lol. What does the first bit do?


    Thanks so much for getting me there guys.

  10. #10
    Registered User
    Join Date
    07-08-2012
    Location
    Melbourne Australia
    MS-Off Ver
    Excel 2003
    Posts
    79

    Re: Wanna make a Userform Close and Save - Then open a different workbook?

    good result

    first bit was just defining the workbooks if there name wasn't "WB1" incase you change things up but hey probably not essential

+ 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