Need code to set crop settings on picture copied from Excel


Brent E

Good afternoon,

I need to figure out VBA code to set "CropLeft, Cropbottom, CropTop, and
CropRight" property settings for a picture copied from Excel and pasted in
I use an Access module to control Excel and Word using object variables.

I use a object variable called OBJEWORD in an Access procedure to control
I can get Word to run fine and add a new document, I can get document to
paste pic fine from Excel, but if I try to set properties for picture in
Word, I keep getting an error and must debug.
I setup a macro in Word to make sure code is correct. That works fine, but
if I use that code from Word macro and paste to access module, and add
OBJEWORD in front of those commands, doesnt work.
These commads are from a word macro code that works:
Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 144#
Selection.InlineShapes(1).Width = 210.95
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
I added a OBJECT variable in front of these in my access module thinking I
could run these from access. Commands look like this
'OBJEWORD.Selection.InlineShapes(1).Fill.Transparency = 0#
'OBJEWORD.Selection.InlineShapes(1).Line.Weight = 0.75
'OBJEWORD.Selection.InlineShapes(1).Line.Transparency = 0#
'OBJEWORD.Selection.InlineShapes(1).Line.Visible = msoFalse
'OBJEWORD.Selection.InlineShapes(1).LockAspectRatio = msoFalse
'OBJEWORD.Selection.InlineShapes(1).Height = 344.15
'OBJEWORD.Selection.InlineShapes(1).Width = 540#
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.ColorType =
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.CropRight = 0#
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.CropTop = 0#
'OBJEWORD.Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
Also tried to use a with statement and no difference.

Anybody know a way I can set these properties for pic pasted in Word using
my object variable?


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