Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Programmatic document assembly in Word 2007 (Office 2007)

    Having just "upgraded" from Office 2003 to 2007, I find that many of my automation routines involving Word have been broken, especially automation of Word from Access routines.
    I had some access 2003 VBA that compiled a sequence of pre-written documents (doc1, doc2...docn) for a travel intinerary, selecting and arranging them in the order of visiting the places concerned. The key method used was objWord.Selection.InsertFile ("Cathdocument filename.doc") to insert both the TEXT and the images and so on into the master document being compiled.
    But this method has been emasculated! Now it only inserts the text - no images. There does not seem to be any easy way to fix this. It's a nightmare. What was wrong with that nice, easy method?
    Can anyone suggest a solution please?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Programmatic document assembly in Word 2007 (Office 2007)

    Just in case it makes any difference, how about specifying some of the possible parameters and testing/toggling them to see whether any makes a difference:

    <code>objWord.Selection.InsertFile FileName:="Cathdocument filename.doc", ConfirmConversions:=True, Link:=False</code>

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Programmatic document assembly in Word 2007 (Office 2007)

    I have found the solution, and probably the cause!
    I don't think many people would know about this DEFECT in Word 2007, so I am posting my solution.
    It's because of the fact that Microsoft has only half-implemented its new graphic engine in Word 2007.
    You will notice that you can't group an inserted image (with the new round corner handles - not the old classic square ones) with, say, a text box or drawing anymore.
    (if you want to do this, you have to convert the graphic into a form that the older built in graphic engine will handle by inserting a drawing canvas, cutting and pasting the graphic
    into the canvas, then dragging it out again. You can then delete the canvas and the converted graphic will have square handles and be able to be grouped BUT...
    any images grouped with drawing objects or text boxes in Word 2007 will not be included when you programmatically insert a document containing them using a line like:
    .InsertFile ("D:French CottagesaaaCoreDocumentsUzès.docx")
    GEE, THANKS MICROSOFT FOR NOT POINTING THIS OUT! I have just wasted four days and several bottles of champagne (to assuage the stress) trying to figure it out!
    The same problem arises if you try another approach (as I did) like:
    For Each mytemplate In Templates
    If mytemplate.Name = "Building Blocks.dotx" Then _
    mytemplate.BuildingBlockEntries("Uzès").Insert Where:=Selection.Range, RichText:=True
    Next
    This is supposed to be the VBA equivalent of inserting the Quick Part called "Uzès", which, by the way DOES handle images grouped with other objects,
    just to make things even more confusing.
    They must have been in a desperate hurry to get Office 2007 out if they only half finished the software.
    Another Microsoft triumph over commonsense.

Posting Permissions

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