Results 1 to 5 of 5

Thread: Opening a saved microsoft word document

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    1

    Opening a saved microsoft word document

    ok guys i use Visual basics express edition 2008. What i need help with is code for opening an already saved (one that i created) microsoft word document using a button in VB. PLz do comment 2 help. Thankz in advance.

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Opening a saved microsoft word document

    Although you want to opena word doc, I think you need to post in the VB.Net forum.


    as a guess as I haven't done much in .Net, you'd need to reference the office object and access all the methods and properties through your objects.

    ie create a word application, using the reference to it, open a doc, and using the reference to that do what you need to for printing/updating the doc.

    There should be examples at the top of the .Net forum (or links to).

    Once you have some code that doesn't work, post up in there for advice.

    Good luck

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Opening a saved microsoft word document

    check the tutorial post at the top of this forum for automating office applications

    there is tutorial on working from vb.net as well
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Opening a saved microsoft word document

    Moved To VB.NET

  5. #5
    Hyperactive Member koolprasad2003's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    443

    Arrow Re: Opening a saved microsoft word document

    just give the reference of Office 11.0 and word 11.0 namesapce from COM

    imports microsoft.office.interop.word

    Code:
    dim objApp as new Word.Application
    dim objDoc as new Word.Document
    objApp.Documents.Open("\\Word file path")
    objApp.visible = true
    it will open your saved file.

    regards
    MCP, MCTS, Microsoft MVP [Asp.Net/IIS]

    For more .NET development tips visit .NET Tips

    If the post is useful then please Rate it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width