G
Gary
The access new group suggested for me to post here on the Visio group.
I have an embed Visio drawings in an OLE Object field of a Access Table.
This allows me to move the drawings around with its data. I need a program
of taking the embed Visio data and inserting it into power point.
I have a first cut of this, but the program run slow because it first
activate the embed Visio OLE Object and and I save it to a temp file and use
an AddOLEObject to add it into power point.
I have a form which is associated with the table that has the Visio
OLEObject. It create a bound object and set the verb = -2 which opens up the
Visio separately when I activate the OLEObject. I then saveas the activated
Visio to the temp file. I noticed that AddOLEObject take a file and inserts
it.
Here is my code:
Private Sub Command19_Click()
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.8 * 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", Link:=msoFalse
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
End Sub
Can some one help me to make this run faster?
My technique is openning all these windows and closing them and its takes
about 3-4 second per slides. If someone can show me what to do where these
windows are not open, it should be faster, or a better solution would be
great!
In the AddOLEObject, it seems to be a one to one scalling between the Visio
to the power point. Can some one also show me how to have the ability to
scale the Visio to fit full size on the power point?
I need all the help I can get. Thank You,
G
I have an embed Visio drawings in an OLE Object field of a Access Table.
This allows me to move the drawings around with its data. I need a program
of taking the embed Visio data and inserting it into power point.
I have a first cut of this, but the program run slow because it first
activate the embed Visio OLE Object and and I save it to a temp file and use
an AddOLEObject to add it into power point.
I have a form which is associated with the table that has the Visio
OLEObject. It create a bound object and set the verb = -2 which opens up the
Visio separately when I activate the OLEObject. I then saveas the activated
Visio to the temp file. I noticed that AddOLEObject take a file and inserts
it.
Here is my code:
Private Sub Command19_Click()
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.8 * 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", Link:=msoFalse
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
End Sub
Can some one help me to make this run faster?
My technique is openning all these windows and closing them and its takes
about 3-4 second per slides. If someone can show me what to do where these
windows are not open, it should be faster, or a better solution would be
great!
In the AddOLEObject, it seems to be a one to one scalling between the Visio
to the power point. Can some one also show me how to have the ability to
scale the Visio to fit full size on the power point?
I need all the help I can get. Thank You,
G