Open a Excel File from Word

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nkg6971
    New Member
    • Feb 2008
    • 3

    Open a Excel File from Word

    Hello All,

    How can a excel file is open from ms word through a code ? Kindly advised.

    Thanks
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by nkg6971
    Hello All,

    How can a excel file is open from ms word through a code ? Kindly advised.

    Thanks
    This question has already been answered in other threads, anyway:

    [CODE=vb]dim obj1 as object
    set obj1 = createobject("e xcel.applicatio n")
    obj1.visible=tr ue
    obj1.wokbooks.o pen("c:\mybook. xls")[/CODE]

    will do.
    Remember that if you use some macro recorded with excel in your word's VBA, the xl constants wont work. search in the object browser (F2) or while debuging the code for its numeric value.

    HTH

    Comment

    • werks
      New Member
      • Dec 2007
      • 218

      #3
      Originally posted by nkg6971
      Hello All,

      How can a excel file is open from ms word through a code ? Kindly advised.

      Thanks
      I'm a bit confused with your question nkg6971. Correct me if I'm wrong but you want an Excel file be open using MS Word codes???

      Comment

      • kadghar
        Recognized Expert Top Contributor
        • Apr 2007
        • 1302

        #4
        Originally posted by werks
        I'm a bit confused with your question nkg6971. Correct me if I'm wrong but you want an Excel file be open using MS Word codes???
        well that's a good question, and some clarification might be needed...

        but since this is a VB forum, i'll assume it's a VBA question.

        Comment

        • werks
          New Member
          • Dec 2007
          • 218

          #5
          Please post your feedback nkg6971 so we can help you..

          --
          Kenneth
          "Better Than Yesterday"

          Comment

          • nkg6971
            New Member
            • Feb 2008
            • 3

            #6
            Originally posted by kadghar
            well that's a good question, and some clarification might be needed...

            but since this is a VB forum, i'll assume it's a VBA question.


            Thanks Kadghar, I have got the solution as the code given by you.

            Comment

            Working...