Picture Border

G

ghagg

Word 2007

Looking for help with vba code to place a border around a picture.


Thanks

DataH

(Also, this posting was made originally in word.vba where little activity
occurs) Sorry for any confusion
 
J

Jay Freedman

It would be helpful to see any code you already have, and what is or isn't
working. Also, be specific about whether the pictures are in line with text
or have some other wrapping, or may be either; whether or not they're on a
drawing canvas; and what line style and color you want for the border.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
D

dataH

Thank you for your reply; I have been using the code below which actually
applies to text. The borders look good on three sides only, the left side
shows white space. The better choice i believe is once a photo is selected,
picture tools and format become available, and then picture border gives a
very nice clean border on all four sides. This feature is not available
from record macros.

DataH


Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
On Error Resume Next
With Selection.Font
With .Borders(1)
.LineStyle = wdLineStyleNone
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
'.Color = wdColorBlue
End With
.Borders.Shadow = False
End With
' With Options
' .DefaultBorderLineStyle = wdLineStyleSingle
' .DefaultBorderLineWidth = wdLineWidth050pt
' .DefaultBorderColor = wdColorAutomatic
' End With
With Selection
.InlineShapes(1).ScaleHeight = InchesToPoints(6.4)
.InlineShapes(1).Width = Selection.InlineShapes(1).ScaleHeight
End With
 
D

dataH

I may not have answered some of your questions, i was interrupted. let me
try again.

The pictures are in line with text on a separte paragraph, and some are in
individual table cells. No wrapping other than paragraph. I'm looking for
a single line border, say black. I believe i want to put it in a drawing
canvas? Not sure. When i choose picture tools and format on the menu after
selecting the picture, is that a picture canvas? If so, that is what i
want.

Sorry for the confusion, but i am somewhat confussed. Straight me out,
thanks Also, (See below)

Best regards,
DataH
 
J

Jay Freedman

Well, with .LineStyle = wdLineStyleNone, I'm surprised that you see any
border at all, but maybe that's just an editing change you forgot you made.
Anyway, if the selection contains an inline picture, the code should change
the properties of Selection.InlineShapes(1).Borders instead of those of
Selection.Font.Borders:

Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
On Error Resume Next
With Selection.InlineShapes(1)
.ScaleHeight = InchesToPoints(6.4)
.Width = .ScaleHeight
With .Borders
.OutsideLineStyle = wdLineStyleSingle
.OutsideLineWidth = wdLineWidth050pt
.OutsideColor = wdColorAutomatic
End With
End With

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
D

dataH

Thank you very much Jay, my picture borders now work perfectly.

I just can't say enough good about the MVP group and your help. Automation
is fantastic.

Best regards,

DataH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top