Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help formatting picture orientation please 2

Status
Not open for further replies.

angiem

MIS
Sep 29, 2000
116
0
0
CA
I am importing a number of photos in a word document. The photo's are a mix of portrait/landscape. I have some code to try and rotate the portrait ones but it doesn't seem to work can anyone help please.


Code:
objWordApplication.Selection.InlineShapes.AddPicture(filename:=strFullName, LinkToFile:=False, SaveWithDocument:=True, Range:=v_range)

intCount = objWordApplication.Documents(1).InlineShapes.Count

If strOrientation = "Portrait" Then
   objWordApplication.Selection.ShapeRange.Rotation = 90#
   objWordApplication.Documents(1).Selection.ShapeRange.IncrementRotation(90.0#)
                    
End If

Thanks

Angie
 
but it doesn't seem to work"

Please explain what that actually means. Nothing happens? Something happens, but it is not what you expected?

Please explain intCount. Where, and how are you using it? You do not appear to be actually actioning any object.

Declare an object as the Added InlineShape, then action it...or set an InlineShape object as the count (intCount), and then action that.

faq219-2884

Gerry
My paintings and sculpture
 
Hi Angie,

I suspect you're getting a 'permission denied' error. AFAIK, only Word's autoshapes can be rotated within Word - at least that's all Word 2000 allows.

Cheers

[MS MVP - Word]
 
InlineShapes can not be rotated. Shapes can. For example:
Code:
  Dim myShape As Shape
ActiveDocument.Shapes.AddPicture _
            FileName:="C:\tripImages\kobausign.jpg", _
        LinkToFile:=False, SaveWithDocument:=True
Set myShape = ActiveDocument.Shapes(1)
myShape.IncrementRotation (90)
ShapeRange objects can be rotated, but again, an InlineShape is not part of ShapeRange. You are inserting an InlineShape, and then trying to action it as if it is a Shape. They are very different beasts. As it stands, your code will never work.


faq219-2884

Gerry
My paintings and sculpture
 
Hi Jerry,

No rotation with Word 2000, even though it supports both the .Rotation and .IncrementRotation methods.

FWIW, Word 2000 doesn't allow a floating picture to be rotated via Format|Picture|Size, either - the rotation option is greyed out.

Cheers

[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top