+ Reply to Thread
Results 1 to 3 of 3

Opening a word document and adding text to it

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    Nederland
    MS-Off Ver
    Excel 2003
    Posts
    3

    Opening a word document and adding text to it

    Dear all,

    I wrote the following macro with which I open a word document:


    Set word = CreateObject("word.application")
    word.Visible = True
    word.documents.Open ("C:\Documents and Settings\aa471714\Desktop\Sop_template_Zuilen")

    No i would like however that I can also insert something (preferably in an input box) which automatically is put in the word file I open. The text should be put after a phrase called "Invoice". Anybody a clue on how I can do this?

    Dear regards,

    Marc

  2. #2
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Opening a word document and adding text to it

    Hi Marc
    Based on your post this is a Word Issue and not an Excel one. However what you need to do is in the file that you are opening from Excel you need to save it as a template first of all. Then in that same template create an a bookmark where you want the user input to be placed. Then create AutoOpen macro that prompts the user for input and then searches for the Bookmark you have created and places the text. This can be done by recording the macro first the cutting and pasting it into your AutoOpen macro.
    Hope this helps.
    Good luck.
    Tony

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Opening a word document and adding text to it

    Be smart: insert a docvariable (one of the fields), name 'faktuur' after the word 'invoice'.
    The only thing you need is

    Please Login or Register  to view this content.
    Last edited by snb; 07-30-2013 at 07:18 AM.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Add text to Existing Word Document if it Doesn't exist create Word Document
    By unstable81 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2013, 12:15 AM
  2. opening word document from VBA
    By tryer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2009, 04:02 PM
  3. Opening Word document with Excel
    By Mr.Jones in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 01-11-2007, 10:13 AM
  4. [SOLVED] Opening a word document
    By RobH in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2006, 07:41 AM
  5. [SOLVED] Opening Word Document with excel
    By [email protected] in forum Excel General
    Replies: 1
    Last Post: 03-20-2005, 10:24 PM

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