Results 1 to 3 of 3

Thread: Hooking Up To Word

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Greenville
    Posts
    73
    Does ANybody have a copy of some code I can use to hook to my app to a Document in Word??? So to open Word from VB. I also want to paste some fields from a DB into the Word document so any samples to look at of that would be excellant to! Thanks.

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    This is something I posted a few weeks ago.


    I got this off of MSDN:

    http://msdn.microsoft.com/vbasic/technical/pasttips.asp

    For the Week of April 26th
    Creating Professional Documents with Code

    Have you ever wanted to create polished, professional documents, like those created in Microsoft Word, through the use of code? Follow these easy steps to make it happen:

    First add a reference to your project for "Microsoft Word 8.0 Object Library" (MSWORD8.OLB).

    Then add the following code to create an instance of Word and add text to a new document:

    Dim objWord As New Word.Application

    '-- Show Microsoft Word
    objWord.Visible = True

    '-- Add new Document
    objWord.Documents.Add

    '-- Add text to Document
    objWord.Selection.TypeText "Visual Basic!"

    '-- Select all Text
    objWord.Selection.WholeStory

    '-- Change Font Size
    objWord.Selection.Font.Size = 50

    Set objWord = Nothing

    Check out the Object Browser for more properties and methods exposed by the Word Object.


    --------------------------------------------------------------------------------

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Greenville
    Posts
    73
    Does Anybody know have any code that will open a document that already exists??? Then Paste info in.

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