Hi Brandon,
If you:
• use a table with fixed row heights and column widths;
• apply editing restrictions
a ContentControlOnExit macro can be used to limit what users can do with the inserted pictures.
For installation instructions, see:
http://www.gmayor.com/installing_macro.htm
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim iShp As InlineShape, TblCell As Cell, StrPwd As String, Prot
StrPwd = "" 'password
With ActiveDocument
Prot = .ProtectionType
If Prot <> wdNoProtection Then .Unprotect StrPwd
End With
With ContentControl
If .Type = wdContentControlPicture And .Range.Information(wdWithInTable) Then
With .Range
Set TblCell = .Cells(1)
If .ShapeRange.Count > 0 Then
With .ShapeRange(1)
.LockAspectRatio = msoTrue
.Width = TblCell.Width
If .Height > TblCell.Height Then .Height = TblCell.Height
End With
GoTo ShpExit
End If
Set iShp = TblCell.Range.InlineShapes(1)
iShp.LockAspectRatio = msoTrue
iShp.Width = TblCell.Width
If iShp.Height > TblCell.Height Then iShp.Height = TblCell.Height
.ParagraphFormat.LeftIndent = TblCell.LeftPadding * -1
End With
End If
End With
ShpExit:
If Prot <> wdNoProtection Then
ActiveDocument.Protect Type:=Prot, NoReset:=True, Password:=StrPwd
End If
Application.ScreenUpdating = True
End Sub
If your document has the editing restrictions password-protected, you'll need to add the password between the double-quotes in StrPwd = "".
Now for some caveats:
Even if you use a ContentControlOnExit macro, the user can still rotate the picture, but they could do that outside Word, anyway. More importantly, if
• Word’s picture insertion mode (File|Options|Advanced>Cut,Copy,Paste) is other than in-line; and
• the user uses the Insert|Picture dialogue (which is not disabled when editing restrictions are applied) to insert the picture instead of doing so by double-clicking on the Content Control,
the user can drag the picture to wherever they want, provided it's top is lower than the top of the cell concerned. When they do, the picture will still snap back to within the cell's horizontal alignment, but it ignores the vertical alignment altogether and there seems to be no way to correct it in code – I’ve tried all manner of adjustments to the .Top value and .RelativeVerticalPosition settings and the picture sullenly remains wherever it was dragged to – even below the table.
See attached file.