#1
|
|||
|
|||
Macro to format picture
Hey guys, a friend asked me about a macro to do some picture formatting on a Mac but I have no idea where to start with this one. This is what she would like the macro to do after selecting an image:
1. Format Picture menu 2. Wrap Text – Top and Bottom 3. Border – Dark Gray 4. Shadow – outer Any suggestions? |
#2
|
||||
|
||||
Your description is a bit vague. Try the following for a starting point:
Code:
Sub Macro1() With Selection If .InlineShapes.Count <> 1 Then Exit Sub With .InlineShapes(1) With .Borders .Enable = True .OutsideLineWidth = wdLineWidth300pt .OutsideLineStyle = wdLineStyleSingle .OutsideColorIndex = wdGray50 End With .Shadow.Visible = True .Shadow.Style = msoShadowStyleOuterShadow .Shadow.Size = .Height .ConvertToShape End With .ShapeRange(1).WrapFormat.Type = wdWrapTopBottom End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Yes Paul, she was a little vague. When I run this code I get an error on the line
[.OutsideLineWidth = wdLineWidth300pt] I've changed the line width with no success. Suggestions? |
#4
|
||||
|
||||
Try swapping the order of:
.OutsideLineWidth = wdLineWidth300pt .OutsideLineStyle = wdLineStyleSingle
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Try the following
Dim shp As word.Shape
'' Works on the currently selected Shape Set shp = Selection.ShapeRange(1) '' If you know which Shape, by index or by Name, then ' Set shp = ActiveDocument.Shapes(indexOrName) '' If the object is currently an InlineShape it must first '' be converted to a Shape ' Set shp = InlineShapeObject.ConvertToShape shp.WrapFormat.Type = wdWrapFront |
#6
|
||||
|
||||
The error message reported by the OP has nothing to do with your supposition that the image is a wrapped shape; indeed, the desire to apply top/bottom wrapping implies it is not.
That simply isn't true; the borders & shadowing - which your code doesn't even attempt - can be applied beforehand. Moreover, your own code for the wrap format conversion follows your attempt to process the selection as a shape (it must precede that!!).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to exit from Format 'Picture Tools'? | ftcnet | Word | 1 | 07-28-2016 12:21 AM |
what picture format best for first pdf then printing | ketanco | Word | 1 | 04-11-2016 05:46 PM |
Macro to select an { includepicture } field code and format the picture behind text and 100% scale | sanpedro | Word VBA | 3 | 03-30-2015 10:50 PM |
"format picture" - arrows show as no line atop picture | marbeth | Word | 3 | 07-08-2011 02:16 PM |
Problem w/ Format Picture (size) | John Woram | PowerPoint | 0 | 01-31-2010 10:29 AM |