+ Reply to Thread
Results 1 to 6 of 6

Opening an excel spreadsheet from Command Button

  1. #1
    Registered User
    Join Date
    12-06-2008
    Location
    UK
    Posts
    58

    Opening an excel spreadsheet from Command Button

    Good Morning,
    I am looking for some assistance, this may be a simple and easy question to answer for some of you guys however i am struggling with this.

    I have an excel sheet that has 3 command buttons on it, i am wanting to open a saved excel sheet that i have on my shared drive from the command button. I know the path of the saved file but how do i get the button to open this file?

    As well as this i this i also have another command button what i want to open another sheet in the excel document with the command buttons.

    Your assistance is greatly appreciated
    Last edited by cruiser102; 01-26-2009 at 08:12 AM. Reason: Solved

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Opening an excel spreadsheet from Command Button

    Please Login or Register  to view this content.
    ?

    Many things can be deduced by recording a macro and then inspecting the results - try that first, it's normally quicker than posting.

    HTH
    Last edited by Cheeky Charlie; 01-26-2009 at 06:42 AM. Reason: code tags - hardly seems worth it...

  3. #3
    Registered User
    Join Date
    12-06-2008
    Location
    UK
    Posts
    58

    Re: Opening an excel spreadsheet from Command Button

    Thanks, Call me simple but i am still not sure on this.

    I have tried to record a Macro and done the following:
    -Clicked on the command button,
    -Minimized the excel sheet,
    -located the file and opened it,
    - stopped the macro recording

    When i looked at the Code in the edit screen it just said


    Application.WindowState = xlMinimized

    ??

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Opening an excel spreadsheet from Command Button

    oh dear! Never mind.

    The code is pretty simple, just type 'workbooks.open ' and the arguments should pop up for you to define.

    HTH

  5. #5
    Registered User
    Join Date
    12-06-2008
    Location
    UK
    Posts
    58

    Re: Opening an excel spreadsheet from Command Button

    I think i must be stupid....

    I still cant get them to work. I enter the path as this
    'Private Sub CommandButton1_Click()
    Workbooks.Open (C\DocumentsandSettings\Mark\Desktop\NewTaskingTemplate.xls)As Workbook

    End Sub

    And it comes up with errors and i cant get it to work.

  6. #6
    Registered User
    Join Date
    12-06-2008
    Location
    UK
    Posts
    58

    Re: Opening an excel spreadsheet from Command Button

    i have solved this now.
    great 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