OLE SnapshotFile Automation

J

Jim Machia

I have user's who add a SnapshotFile (MS Access Export) to
a new slide and they crop and scale the shape to fit the
slide. Before cropping the slide they Zoom and Fit the
file in the OLE Object. I tried automation the SendKeys to
Zoom And Fit but it didn't work. I know mouse clicking
works but I wasn't sure how to handle mouse positioning
over the slide. Is there any other way to have OLE object
on file zoomed and fit ?

Part 1: AddOLEObject from an Open File
==============================
ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject
(Left:=0#, Top:=0#, Width:=720#, Height:=540#,
FileName:=fstr, Link:=msoFalse).Select
If ActiveWindow.Selection.ShapeRange.OLEFormat.ProgID
<> "SnapshotFile" Then Exit Sub
ActiveWindow.Selection.SlideRange.Shapes(1).Select

Part 2: Zoom And Fit
============
SendKeys "{ENTER}", True
SendKeys "+{F10}", True
SendKeys "{DOWN}", True
SendKeys "{RIGHT}", True
SendKeys "{UP}", True
SendKeys "{UP}", True
SendKeys "{ENTER}", True
ActiveWindow.Selection.Unselect

Part 3: Crop And Resize
===============
ActiveWindow.Selection.SlideRange.Shapes(1).Select
ActiveWindow.Selection.ShapeRange.PictureFormat.CropLeft =
24.32
ActiveWindow.Selection.ShapeRange.PictureFormat.CropRight
= 24.32
ActiveWindow.Selection.ShapeRange.PictureFormat.CropBottom
= 14.58
ActiveWindow.Selection.ShapeRange.PictureFormat.CropTop =
14.58
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -30#
.IncrementTop -18#
End With
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 1.07, msoFalse, msoScaleFromTopLeft
.ScaleHeight 1.07, msoFalse, msoScaleFromTopLeft
End With
ActiveWindow.Selection.ShapeRange.ScaleWidth 1.02,
msoFalse, msoScaleFromTopLeft
ActiveWindow.Selection.Unselect
 
S

Shyam Pillai

If you can automate the zoom value in the Access then you can do the same
from within PowerPoint -
ActiveWindow.Selection.SlideRange.Shapes(1).OLEFormat.Object
will return a reference to the snapshot object which can then be automated.
 
J

Jim Machia

Shyam,
I tried referencing the object at some point in time too and not sure if
there is something else I'm missing, when I tried setting the Zoom property
of the object, I get error number 430 which indicates the class object does
not support automation. I even added the snapshot viewer as a reference.

ActiveWindow.Selection.SlideRange.Shapes(1).OLEFormat.Object .Zoom = 0

Or

Debug.Print ActiveWindow.Selection.SlideRange.Shapes(1).OLEFormat.Object
..PageCount
 

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