Stephen:
This is a on go thing. What I really wanted was to create a file and then
the AddOLEObject to insert the OLE object into powerpoint.
The code below works, but it is displaying all of the windows and is slow.
I created a form with a bound object called OLEFile. I have a button
which
execute the following code:
Dim oPPT As PowerPoint.Application
Dim oPres As Presentation
Dim xWidth As Integer, yHeight As Integer
Dim AppVisio As Visio.Application
Dim docsObj As Visio.Documents
Dim DocObj As Visio.Document
Dim pagsObj As Visio.Pages
Dim pagObj As Visio.Page
Dim db As Database
Dim T As DAO.Recordset
Set db = DBEngine.Workspaces(0).Databases(0)
Set T = db.OpenRecordset("tblLoadOLE")
T.MoveFirst
Set oPPT = New PowerPoint.Application
Set oPres = oPPT.Presentations.Add(True)
Const ppLayoutBlank = 12
Const ppSaveAsPresentation = 1
xWidth = (11 * 1440) / 20
'yHeight = (8.5 * 1440) / 20
yHeight = (6.8169 * 1440) / 20
oPres.PageSetup.SlideWidth = xWidth
oPres.PageSetup.SlideHeight = yHeight
Do Until T.EOF
'For i = 1 To 2
Me![OLEFile].Action = acOLEActivate
Set AppVisio = GetObject(, "visio.application")
Set DocObj = AppVisio.ActiveDocument
DocObj.SaveAs "c:\access 2006\MyDrawing.vsd"
AppVisio.Quit
Set AppVisio = Nothing
oPres.Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.AddOLEObject Left:=0, Top:=0, Width:=xWidth,
Height:=yHeight, FileName:="c:\access 2006\MyDrawing.vsd"
DoCmd.RunCommand acCmdRecordsGoToNext
T.MoveNext
Loop
' Next i
oPres.SaveAs "c:\access 2006\MyDrawing.ppt", ppSaveAsPresentation, True
oPres.Close
Set oPres = Nothing
oPPT.Quit
Set oPPT = Nothing
The code first of all activate the OLEObject from the Table and open it
separately. I set the verb = -2 on the bound object so I can saveAs to a
file. I then used the AddOLEObject with power point and inserted the
object
into a side.
I assume I can link the object too??? How is this done??
Can someone help me improve upon my code??
Thank You,
Gary
Stephen Lebans said:
Once the object is Activated you would call the objects Save or SaveAs
method.
From the main Acccess Database window:
Press Ctrl + G to get to the VB IDE
RIght Click anywhere and select Object Browser
In the top left corner select the Library Combo, select the library of
interest - ie. Word or Excel
Examine the methods and properties the object exposes.
Above assumes you have set a Reference to the proper version of the MS
Office library.
Is this an ongoing issue where you want to save a copy of the object to
disk? Why not link instead of embedding? What exactly do you need to
accomplish?
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.