Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 11-24-2024, 02:20 PM
macropod's Avatar
macropod macropod is offline how to have fixed nested table size when pasting image Windows 10 how to have fixed nested table size when pasting image Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

OK, make sure you have set the preferred width for the nested table and its column to however many inches/centimeters you require.

Then, for the cell, check the 'fit text' property. This will stop the cell expanding but may result in parts of pictures that are wider than the cell when fitted to the row height disappearing. The following macro will correct such images after they're inserted.

You can select either a single cell or a whole table for processing - which means to can leave the resizing till the end.

Fiddling with the 'fit text' property isn't really necessary, but it prevents the rest of the parent cell's layout being messed with before the macro is run.

Code:
Sub FitPics()
Dim Tbl As Table, TblCl As Cell, Cell As Cell, i As Long, sWdth As Single
With Selection
  If .Information(wdWithInTable) = False Then Exit Sub
  For Each Cell In .Cells
    With Cell
      sWdth = .PreferredWidth
      For i = 1 To .Range.InlineShapes.Count
        With .Range.InlineShapes(i)
          .LockAspectRatio = True
          If .Width > sWdth Then .Width = sWdth
        End With
      Next
    End With
    For Each Tbl In Cell.Tables
      For Each TblCl In Tbl.Range.Cells
        With TblCl
          sWdth = .PreferredWidth
          For i = 1 To .Range.InlineShapes.Count
            With .Range.InlineShapes(i)
              .LockAspectRatio = True
              If .Width > sWdth Then .Width = sWdth
            End With
          Next
        End With
      Next
    Next
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting an image from another PPT file shrinks some text on the page to a smaller size. Why? User1 PowerPoint 0 12-15-2022 08:26 AM
how to have fixed nested table size when pasting image Pasting Image inside Table and Resize Image Not Working Grahamers2002 Drawing and Graphics 5 07-02-2018 04:49 PM
userform fixed size string Vibov Excel 0 03-07-2015 04:27 AM
copying nested if over multiple rows where one value stays fixed charles_cat Excel 1 01-23-2015 01:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft