Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set Picture as Autotext Range (Word 97SR2)

    This code

    thisdocument.shapes("Logo").Select

    will let me do this:

    NormalTemplate.AutoTextEntries.Add Name:="EnvelopeExtra1", Range:=Selection.Range

    The problem is "Thisdocument" then becomes the activedocument and subsequent statements that refer to Activedocument now refer to the global code template, NOT the document. I can't have that.

    I get expected "Type mismatch" errors with

    Dim RALogo As Shape
    or
    Dim RALogo As ShapeRange
    or
    Dim RALogo As Range

    How can I get that Shape in a Range so it can then be applied to the Autotext range?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Picture as Autotext Range (Word 97SR2)

    Kevin,

    I can't help with the specific question, but I can give a workaround

    dim docWorking as Document

    Set docWorking = ActiveDocument

    'Your shape selecting code goes here

    docWorking.Activate

    Basically what this does is create a document object that you point to the document you are working on, then you do your logo selecting and insert it as an autotext entry, the reactivate the first document so that it becomes the active document again.

    Just as an aside, I would recommend that you don't use ActiveDocument. Instead use a dimmed doc object. Only use ActiveDocument to set the dimmed doc object to the active document.

    As you have noticed, the Active Document changes sometimes and breaks code.

    Just my <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15> CAD worth
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Picture as Autotext Range (Word 97SR2)

    Bryan,

    I wanted to think about this before responding. I be done thinkin'

    I decided to

    strDocName = activedocument.name
    thisdocument.shapes("Logo").Select
    'assign to autotext
    Document(strDocName).Activate

    instead. But thanks for making me think!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Picture as Autotext Range (Word 97SR2)

    Glad to have helped.

    Even while on vacation <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

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