• Finding an item when on first line of a paragraph

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Finding an item when on first line of a paragraph

    Author
    Topic
    #355393

    Using Word 97 SR2.
    I need to find an inline graphic when the graphic is in the first line of a paragraph and then change the position of the graphic to 0 (Font.position = 0).

    I also need to find an inline graphic when the graphic is NOT in the second or following line of a paragraph and then change the position to 0 and the paragraph to single spacing.

    I know how to find graphics and apply the formatting. What is stumping me is how to find the graphic only when it is in the first line or only when it is not.

    Thanks for your help!!
    Troy

    Viewing 0 reply threads
    Author
    Replies
    • #524031

      Troy,

      The immediate problem here is getting a definition of “shape is in first line of para”, that corresponds to something that Word VBA can latch onto.

      It seems that, in the user interface, that Word wants to attach the object anchor for a shape or inline shape, to the first line of the paragraph. You can move an inline shape up and down in the paragraph all you want, but the object anchor is going to stay attached to the first line of the paragraph.

      So you’re right to be stumped. This might require some sort of kludgy workaround such as getting the location of the top of the inline shape, in relation to the page, and then comparing that to a value for the top of the paragraph in relation to the page (as in:

      rngCurPara.Information (wdVerticalPositionRelativeToPage)

      I don’t know how reliable that would be, but might be something to take a look at.

      Gary

      • #524271

        Perhaps I was wrong in the terms I used. By “inline graphic” I meant a graphic sitting on a line in a paragraph (with “float over text” DISabled).

        However, I found a work around using a series of searches/replaces.

        After finding the work around, I found that my requirements had changed and I no longer need to differentiate between graphics on the first line and those on the second and following.

        Thanks any way for the help!!!
        Troy

    Viewing 0 reply threads
    Reply To: Finding an item when on first line of a paragraph

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: