Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-29-2011, 01:40 PM
DugganSC DugganSC is offline Editing an embedded OLE object Windows XP Editing an embedded OLE object Office 2007
Novice
Editing an embedded OLE object
 
Join Date: Aug 2011
Posts: 8
DugganSC is on a distinguished road
Thumbs up

Ah, figured it out. The object was embedded as a Shape. I discovered this by first realizing that there was a Context Menu item to open the embedded document whereupon I recorded a macro to access it. For the sake of reference, the macro code I got for finding it, opening it, finding a piece of text, copying what followed it, closing the document, and pasting said text into the header is the following:
Code:
If ActiveDocument.Shapes.Count > 0 Then
        ActiveDocument.Shapes(1).Select
        Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
        
        With Selection.ParagraphFormat
            .LeftIndent = InchesToPoints(0#)
            .FirstLineIndent = InchesToPoints(0#)
        End With
        
        Selection.ShapeRange(1).OLEFormat.DoVerb VerbIndex:=1
    
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = "Document ID"
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute
        Selection.MoveDown Unit:=wdLine, Count:=1
        Selection.HomeKey Unit:=wdLine
        Selection.EndKey Unit:=wdLine, Extend:=wdExtend
        Selection.Copy
        Selection.EscapeKey
        ActiveDocument.Close
        WordBasic.ViewFooterOnly
        Selection.TypeText Text:="Document "
        ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    Else
        MsgBox ("Failed to find cover page")
    End If

Last edited by DugganSC; 08-29-2011 at 01:42 PM. Reason: Fixing a zero-index issue
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing an embedded OLE object Embedded File Atlas Word 1 06-20-2011 04:37 PM
Editing an embedded OLE object Embedded links spheon Word 1 06-07-2011 04:11 PM
Embedded in invitation? admin99 Outlook 0 08-28-2010 05:34 PM
Problem: object library invalid or contains references to object definitions aligahk06 Office 0 08-19-2010 12:29 PM
Could not load this object as this object is not present in your computer k.gaurav Office 0 08-17-2009 09:57 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft