opening another excel workbook through a button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • golf32902
    New Member
    • May 2007
    • 17

    opening another excel workbook through a button

    I was wondering if there was a way to open anouther workbook through a button?
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Sure,

    use something like

    dim Obj1 as object
    set obj1 = createobject("e xcel.applicatio n")
    obj1.visible=tr ue
    obj1.workbooks. open("c:\file1. xls")

    You can use file pickers or something else to make it look pro

    Why dont you check out some other similar questins, you may find some nice things you can use.

    Good Luck
    Kad

    Comment

    • golf32902
      New Member
      • May 2007
      • 17

      #3
      Is there a way to have the file path to just look in the same folder that the first file is in. For example: first file will access the second file through a button. if i email these two file and tell the person to put both of the files into a folder and it still will work. that is what i'm trully looking for.

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by golf32902
        Is there a way to have the file path to just look in the same folder that the first file is in. For example: first file will access the second file through a button. if i email these two file and tell the person to put both of the files into a folder and it still will work. that is what i'm trully looking for.
        hmm why not trying with a file picker for the first one:

        [CODE=vb]
        dim path as string
        with application.fil edialog(msoFile DialogFilePicke r)
        .allowmultisele ct = false
        .filters.clear
        .filters.add "Excel files (*.xls)", "*.xls"
        if .selecteditems. count>0 then
        path = .selecteditems. initialfilename 'im not realy sure about this
        'one but there is for sure a property
        'that gives you the path
        'and place here the code for oppening the path & selecteditems.i tem(1)
        end if
        end with[/CODE]

        And now, for opening file2.xls just open(path & "file2.xls)
        It should be something like that

        Good luck

        Comment

        Working...