From: Jess on
I have an excel sheet that inserts pictures store in folder. Just before
inserting the picture I need to know wether the picture orientation is
landscape or portrait. How can I know that without inserting the actual
picture?

This is the code I use; it determines the pic orientation AFTER inserting
the picture. I would like to avoid inserting the picture; I just need the
orientation.

Set pic = xlApp.ActiveSheet.Pictures.Insert(PictureName)

If pic.ShapeRange.height <= pic.ShapeRange.width Then
PicOrientation = "Landscape"
Else
PicOrientation = "Portrait"
End If

How can I accomplish this?

From: Helmut Meukel on
Dim mypic as StdPicture
set mypic = LoadPicture(PictureName)
If mypic.Height <= mypic.Width then

You still have to load the picture into the object mypic.

HTH.

Helmut.


"Jess" <Jess(a)discussions.microsoft.com> schrieb im Newsbeitrag
news:46EBF3E3-9BED-47C4-A5FC-DD50FFAA01AB(a)microsoft.com...
>I have an excel sheet that inserts pictures store in folder. Just before
> inserting the picture I need to know wether the picture orientation is
> landscape or portrait. How can I know that without inserting the actual
> picture?
>
> This is the code I use; it determines the pic orientation AFTER inserting
> the picture. I would like to avoid inserting the picture; I just need the
> orientation.
>
> Set pic = xlApp.ActiveSheet.Pictures.Insert(PictureName)
>
> If pic.ShapeRange.height <= pic.ShapeRange.width Then
> PicOrientation = "Landscape"
> Else
> PicOrientation = "Portrait"
> End If
>
> How can I accomplish this?
>