🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16389

Re: [VB] Selecting and making text bold.

#16389
From: Brian W. McMahon
Date: Mon, 22 Sep 2003 00:08
31 lines
2559 bytes
Thank you, Roberto, for the code you supplied above. I was able to adapt it to perform a very useful function.

I place Word docs into text frames in ID and wanted to be able to include inline graphics in the Word files (that are also placed and linked and can be updated). If you put the actual graphic itself in the Word doc it does get pasted into ID but it is not linked to the original file.

The following code, borrowed from you, retrieves the name of a graphic included in the Word doc in brackets, eg [mypic.jpg]. It places the graphic at the beginning of the name and then deletes the name, so that all that is left is the linked inline graphic. fullRange is the name with brackets (ie [mypic.jpg]) and graphicCode is the name of the graphic file without the brackets (ie mypic.jpg).

'place the Word doc into ID text frame
myTextFrame.Place docToPlace
'find references to inline graphics
Set myStory = myTextFrame.ParentStory
Set myStart = myStory.Search("[")
Set myEnd = myStory.Search("]")
If myStart.Count > 0 Then
    For counter2 = 1 To myStart.Count
        s = myStart.Item(counter2).Index
        e = myEnd.Item(counter2).Index
        Set fullRange = myStory.Characters.ItemByRange(myStory.Characters.Item(s), _
            myStory.Characters.Item(e)).Item(1)
        Set graphicRange = myStory.Characters.ItemByRange(myStory.Characters.Item(s + 1), _
            myStory.Characters.Item(e - 1)).Item(1)
        fileGraphic = graphicRange.TextContents
        graphicToPlace = folderGraphics & Application.PathSeparator & fileGraphic
        Set myInsertionPoint = fullRange.InsertionPoints.Item(1)
        myInsertionPoint.Place graphicToPlace
        fullRange.Delete
    Next counter2
End If

Thanks again. I never could have figured this out on my own.

Brian McMahon
Technical Details
Message-ID: <1dea3eff.10@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <1dea3eff.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,140ba69269d76fca,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-09-21 17:38:52 PST
From: "Brian W. McMahon" <b.mcmahon@etc.unsw.edu.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: [VB] Selecting and making text bold.
Message-ID: <1dea3eff.10@webx.la2eafNXanI>
Date: Sun, 21 Sep 2003 17:08:10 -0700
References: <1dea3eff.-1@webx.la2eafNXanI>
Lines: 43
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit