Results 1 to 7 of 7

Thread: Insert Picture

  1. #1
    Lounger
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert Picture

    Greetings,
    Is there any way, either in Word 2000 Insert Picture dialog box or in the Insert Picture WOPR macro, to make Link to File or Insert and Link the default instead of Insert (Embed)?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Picture

    Israel,

    I started along this path, but I couldn't get any further.

    I defined a VBA ine "InsertPicture" as follows:

    Sub InsertPicture()
    Dim dlgDialog As Dialog
    Set dlgDialog = Dialogs(wdDialogInsertPicture)
    dlgDialog.linktofile = True
    dlgDialog.Show

    End Sub

    HOWEVER, it didn't work as expected.

    It DID execute my routine, but DID NOT do anything with the "linking".

    You might try something with SENDKEYS- or (as I've had to do sometimes- it depends on your desperation) you may need to write your own routine & dialog box.

    I've never played with this dialog box, but I have found some which do not react as documented, and I've had to reproduce by userforms.

    Not that it's the case here- a SENDKEYS might work well. I've not used that myself, but obviously others in the forum have used with success.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Picture

    Israel,

    PS.

    We used to link to picture files, but we don't any longer- there's too many dangers for us. If the LAN people change the configuration, or the users email to soemone else, the picture is no longer viewable.

    We did the linking because of size- but later versions of Word have enabled embedding of gif and jpeg files, so size because much less of an issue.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Insert Picture

    I agree with Geoff, the LinkToFile appears not to work. A way around that bug is to capture the filename and use that in a separate command such as

    Code:
    Sub temp2()
    Dim sFilePath As String
    With Dialogs(wdDialogInsertPicture)
      .Display
      sFilePath = .NAME
    End With
    MsgBox sFilePath & " is being linked into the file."
    ActiveDocument.InlineShapes.AddPicture sFilePath, True, False
    End Sub
    I wouldn't hijack the InsertPicture command to do this though as you will eventually return to the fold and want to embed the graphic. You can get rid of the MsgBox line if you like.
    Last edited by jscher2000; 2011-06-15 at 21:56. Reason: Repaired code tags.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    Lounger
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Picture

    Actually, I use Insert and Link routinely and enjoy the best of both worlds:
    -Even if someone puts my files on their own computer, the pictures are still there.
    -It is a snap to update pictures (which does happen a lot in my work)
    When the job is done, I make a pdf for delivery.

    Therefore I am interested in hijacking the dialog, or at least the part for selecting embed/link/link & include.

    Referring to the book Word 97 Annoyances, the task seemed easier, but things seem to have changed in W2K, at least to a rank amateur VBA user such as me.

  6. #6
    Lounger
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Picture

    Greetings,
    Yes, MS admits that LinkToFile does not work properly. The following macro, when placed in your normal template or any active global template will provide a quick means to insert pictures as linked (or as Include and Linked, with SaveWithDocument:=True, as below) instead of embedded.

    Ref: MSKB Q209945 with modifications.

    Code:
    Sub LinkToFile()
    With Dialogs(wdDialogInsertPicture)
          .Display                         ' Display dialog only, don't insert.
          If .Name <> "" Then              ' If dialog not Canceled.
             ' Insert as linked file.
             Selection.InlineShapes.AddPicture _
                FileName:=.Name, LinkToFile:=True, SaveWithDocument:=True
          End If
       End With
    End Sub
    Last edited by jscher2000; 2011-06-15 at 21:56. Reason: Added code tags.

  7. #7
    Lounger
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert Picture

    The problem with this macro is that it always gives an absolute link, while the IncludePicture dialog gives a relative link. Does anyone know how to fix it?

Posting Permissions

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