Results 1 to 14 of 14
  1. #1
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Macro to make all linked photos same size & Format (office 2003)

    This may belong in VBA, but I have a doc that i use as my lecture notes with linked powerpoint slides at the right points in the lecture so in an 1 hr lecture I don't get out of sync.in my talk vs the powerpoint that is being shown on a digital projector.
    Is there a VBA macro that will let me make all the linked photos/ showing in the doc the same size for uniformity sake ie 50% or 35% and can they all be centered or if side by side centered side by side but this may be too dificult. And if possible a macro that removes them to print the lecture in total as a handout .
    This may be a lot to ask, not certain
    Thanks and Happy 4th
    JR
    Attached Images Attached Images
    • File Type: jpg a.jpg (93.2 KB, 0 views)

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    Renton, Washington, USA
    Posts
    12,560
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    I do not like resizing within Word or PowerPoint. I make the files I am using the size I need and then insert them. I have better control and the Word or PowerPoint file is MUCH smaller.

    As for using "%" each original file must be the same size to get same percentage size.

    Now running HP Pavilion a6528p, with Win7 64 Bit OS.

  3. #3
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    I don't believe I am resizing the actual slides that word is pointing to in the link to powerpoint. Just the "thumbnail" version of the link in word. The actual powerpoint file remains the same. Again each link is to a different slide, and I am trying to just adjust how I am seeing the slide in word not in the original powerpoint file itself.
    One must be able to run a MACRO and AUTOMATICALLY adjust the link appearances, size, centering etc
    See photo of links
    Thanks
    JR
    Attached Images Attached Images
    • File Type: jpg a.jpg (43.8 KB, 0 views)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    You may be able to use this macro as starting point. It centers linked shapes and sets their size to 50% of the original. Modify as needed.

    Sub EqualizeShapes()
    Dim i As Integer
    Dim n As Integer
    Dim rng As Range
    Dim insh As InlineShape

    On Error GoTo ErrHandler

    Set rng = ActiveDocument.StoryRanges(wdMainTextStory)
    n = rng.InlineShapes.Count
    i = 0
    For Each insh In rng.InlineShapes
    i = i + 1
    StatusBar = "Processing shape " & i & " of " & n
    If insh.Type = wdInlineShapeLinkedOLEObject Then
    insh.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
    ' Adjust as needed
    insh.ScaleHeight = 50
    insh.ScaleWidth = 50
    End If
    Next insh

    StatusBar = ""
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbInformation
    Resume Next
    End Sub

  5. #5
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    Hans
    Beyond great, Thanks
    Any way to add a command box/ to give choices as to whether to make it 25 percent or 50 percent sizing etc and / or to Delete all photos for more condensed printing as handouts???
    Thanks again this works fabulously just like magic
    Jr Klein

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    Here is a modified version that prompts for the scale. The macro quits if you enter an invalid scale percentage.

    Sub EqualizeShapes()
    Dim i As Integer
    Dim n As Integer
    Dim rng As Range
    Dim insh As InlineShape
    Dim intScale As Integer

    On Error GoTo ErrHandler

    intScale = Val(InputBox("Enter scale percentage (e.g. 50)", , 50))
    If intScale < 1 Then Exit Sub

    Set rng = ActiveDocument.StoryRanges(wdMainTextStory)
    n = rng.InlineShapes.Count
    i = 0
    For Each insh In rng.InlineShapes
    i = i + 1
    StatusBar = "Processing shape " & i & " of " & n
    If insh.Type = wdInlineShapeLinkedOLEObject Then
    insh.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
    ' Adjust as needed
    insh.ScaleHeight = intScale
    insh.ScaleWidth = intScale
    End If
    Next insh

    StatusBar = ""
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbInformation
    Resume Next
    End Sub

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    And here is a macro that deletes all linked inline shapes:

    Sub DeleteShapes()
    Dim i As Integer
    Dim n As Integer
    Dim rng As Range
    Dim insh As InlineShape

    On Error GoTo ErrHandler

    Set rng = ActiveDocument.StoryRanges(wdMainTextStory)
    n = rng.InlineShapes.Count
    For i = n To 1 Step -1
    If rng.InlineShapes(i).Type = wdInlineShapeLinkedOLEObject Then
    rng.InlineShapes(i).Delete
    End If
    Next i

    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbInformation
    Resume Next
    End Sub

  8. #8
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    Hans Really great many thanks. The ewqualize function is really quick.
    The delete macro for some reason is slow but this may be becaue of what it has to do vs the code
    Also I have posted in the past but no one at the time had the answer. I am always being prompted when any file that has links loads "Do I want to update the remote links".
    Options for word are set on update remote links automatically I have tried checking and unchecking this but cant seem to get rid of the constant prompt to update remote links yes / no
    Many many thanks. Beyond perfect
    JR

  9. #9
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    You might see a speed improvement if you place the line:
    Application.ScreenUpdating = False

    just after the "Sub DeleteShapes()" line

    and the line:
    Application.ScreenUpdating = True

    just before the "Exit Sub" line.

    Alan

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    About the prompt to update links: perhaps MSKB article How the behavior of the Word fields changes after you install the Word update helps.

  11. #11
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    Alan and Hans
    Yes many thanks makes those lines make all the difference lightening fast now.
    Thanks for all your hard work
    I will read the article
    Happy 4th
    JR

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    I would leave the Security key alone. Try the following - if it doesn't work, you can simply undo it.
    - Quit Word.
    - Start RegEdit and navigate to HKEY_CURRENT_USERSoftwareMicrosoftOffice11.0WordOp tions.
    - If there is a value named FieldCalcSecurityLevel in the right hand pane, double click it and set the value to 0.
    - If there is no such value in the right hand pane, select Edit | New | DWORD Value. Name it FieldCalcSecurityLevel, then double click it and the value to 0.
    - Start Word and open a document with external links to see if you still get prompted.

  13. #13
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    Edited by HansV to reduce screenshot in size. Please don't post pictures over 640 x 480.

    Hans
    This is perfect just what I am experiencing, but it only goes up to version 10, not office 2003 or version 11. I am afraid to copy fieldsecuritylevel of 0 as they state in version 10 to 11 as there is a security key outside of the options key in 11. And not certain can just add the key in options vs changing the security field in the registry which is set to 2 and probably as per the article should be set to 0.
    JR
    Attached Images Attached Images
    • File Type: jpg a.jpg (32.7 KB, 0 views)

  14. #14
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Macro to make all linked photos same size & Format (office 2003)

    Hans;
    WOW, WOW, WOW
    After years of frustration, this appears to work, And it now opens the file in 2 seconds versus 20 seconds for updating large file fields after the prompt.
    Hopefully it is working the way it is supposed to
    Will check it out more
    THnanks thanks
    JR

Posting Permissions

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