+ Reply to Thread
Results 1 to 24 of 24

open a project after clicking a button

  1. #1
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    open a project after clicking a button

    I have a project stored in suppose "C:\documents and settings\desktop\New System"

    I have another project at some other location, It has just one userform and there are about 5-6 buttons on it. The purpose of each button is when the user click on any button then it opens up a project stored in some other location. So can anyone please tell me the code so that when the user clicks on button1 then it will open up a project "New System" as mentioned above.

    Thanks

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    By project you mean WorkBook?

    Please Login or Register  to view this content.
    Last edited by royUK; 09-15-2010 at 08:33 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi Roy

    I am able to open a New system after clicking a button on the current opened system. But my problem is when I close the New system then the current system closes as well. I have written the following code on Logoff button of New System:

    Please Login or Register  to view this content.
    But I want to keep the current system opened unless the user clicks on close button of the current system as there may be a possiblity to perform some other functions with other Commandbuttons.

    So how can we avoid closing the current system when we close the New system opened after pressing a button.

    Thanks

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    Do you mean the instance of Excel? Your code is closing the application as well as the workbook

  5. #5
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi Roy

    I have two projects: 1. Current Project 2. New System

    On the commandbutton click event of current Project, the other project "New System" opens up and when I close the New System then it closes the Current Project too. To close the New System I have tried following line but everytime the current Project closes as well.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Could you please what changes do I need to make so that the current Project remains opened. And also on the workbook_open event of New System and Current Project , I have written
    Please Login or Register  to view this content.
    Thanks

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    I really don't know whay you mean by Project, I've asked if you mean a Workbook or the Application

  7. #7
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Sorry, I mean Workbook. Both the New System and Current Project refer to Workbook

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    Why are you using Application.Quit?
    Last edited by royUK; 09-15-2010 at 10:05 AM.

  9. #9
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    I used Application.Quit but it didn't work then I removed it and used Thisworkbook.close but it still didn't work. What would you suggest me?

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  11. #11
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi All

    Can anyone please look at my problem and solve it. Sorry I can't post the actual workbook as it contains company's confidential data.

    Thanks

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    Then create a dummy one

  13. #13
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi Roy

    Please find attached the two workbooks "Sample1" and "Sample2". When I just open Sample1 and click on button then Sample2 workbook opens up. When I press a logoff button in Sample2 workbook then it closes both the workbooks. But I want it to close Sample2 only and Sample1 should remain open.

    Thanks
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    08-19-2004
    Posts
    60

    Re: open a project after clicking a button

    Nancy,

    When you are closing "Sample 2", the first workbook (Sample 1) is still open, and continues to be. However the Excel application is not visible therefore you cannot see that it is open.

    Change the Userform1 code in Sample2 to this:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi

    If I make those changes you mentioned then the sample2 workbook gets closed and sample1 workbook remains opened but I want to display the startup form in sample1 system . The startup userform doesn't appear after doing this and just the application becomes visible..

    Any other suggestions????

    Thanks

  16. #16
    Registered User
    Join Date
    08-19-2004
    Posts
    60

    Re: open a project after clicking a button

    sorted (i think), try this code:

    Sample 1 - Workbook Code:
    Please Login or Register  to view this content.
    Sample 1 - Form Code:
    Please Login or Register  to view this content.
    Sample 2 - Workbook Code:
    Please Login or Register  to view this content.
    Sample 2 - Form Code:
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi there

    I tried the code today but it didn't work. It seems very easy and I tried other different ways too but no joy... Can anyone please help me to do this.


    Thanks a lot.

  18. #18
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    You really shouldn't be messing about with the application. Simply minimize the workbook, this example will minimize the workbook when the form is initialized

    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi Roy

    It didn't work properly. When I open sample1 workbook then the window is minimized and userform doesn't get display by itself when I click on the minimized window then userform1 gets displayed and also when I click on commandbutton then sample2 workbbok appears and when I close sample2 workbook then again sampl1 workbook becomes minimized and when I click on sample1 workbook then simple worksheet appears and not userform1.

    What I want is when I open up workbook "Sample1" then userform1 should appear where there are lots of options the user can select. Then when the user clicks the command button then userform1 of "sample2" workbook should pop up and when I press logoff button on userform1 then sample2 should be closed but userform1 of sample1 workbook should appear.

    Thanks

  20. #20
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    On the first userform add this to the buttons
    [Me.Hide[/code]

    This will hide the userform when the button is clicked

    In the next userform add something like this to the logoff button
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi guys

    I am back again with the same problem as it didn't work the way I wanted. Please find attached two workbooks(sample1 ,sample2). In the workbook open event of sample 1 , the userform gets displayed and when the button is clicked then userform1 of another workbook should be opened. Which is working fine and now when I press logoff button on userform1 of sample2 workbook then the sample2 workbook should be closed but userform1 of sample1 workbook should become visible so that we can perform any other actions on userform1 of sample1 workbook. But unfortunately this part is not working as when I close workbook2 then workbook1 also gets closed.

    Any help would be much appreciated.
    Attached Files Attached Files

  22. #22
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a project after clicking a button

    You really need to take extreme care when hiding the application.
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Hi Roy

    Sorry but I am back again with the same problem as its not working properly. The workbooks you atttached in the last post. If we click on Enter button in userform1 of sample 1 workbook then userform1 of sample2 workbook gets opened. When we press Logoff button of Userform1 of sample2 workbook then Userform1 of sample1 workbook appears. But my problem is when you click Enter button of userform1 of sample1 workbook again then nothing appears. So the whole system works fine for the first attempt but doesn't work for the second attempt.

    Hope you can solve this problem.

    Thanks

  24. #24
    Registered User
    Join Date
    09-06-2010
    Location
    Bristol
    MS-Off Ver
    Excel 2003
    Posts
    96

    Re: open a project after clicking a button

    Can anyone else please help me to solve my problem?

    Thanks

+ 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