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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export access charts into powerpoint (2) 1

Status
Not open for further replies.

easycode

Programmer
Jan 28, 2005
195
US
I need to make a routine that exports access charts into Powerpoint, I've been reading all day long and no luck, i have the code to create a presentation from access and all slides are "text" but none is a chart.

i have also read all the articles in regarding access and powerpoint but nothing

Does anyone have any ideas or suggestions?
Thanks for any help you may provide, it is greatly appreciated.

Please help
 
Not a lot of help, but you can cut and paste charts from Access to Powerpoint.
 
Yes Remou but i need to automate this process, anyway thans for trying, appreciate it.
 
How about automated cut and paste?
Code:
Sub PowerPointX()
    Dim ppObj As PowerPoint.Application
    Dim ppPres As PowerPoint.Presentation
    
    ' Open up an instance of Powerpoint.
    Set ppObj = New PowerPoint.Application
    Set ppPres = ppObj.Presentations.Add
    
    ' Setup a slide
    With ppPres
        With .Slides.Add(1, ppLayoutTitleOnly)
            .Shapes(1).TextFrame.TextRange.Text = "A Chart"
            
            'From Access
            DoCmd.OpenForm "frmForm"
            Forms!frmForm.OLEChart.SetFocus 
            DoCmd.RunCommand acCmdCopy
            
            'To PP
            .Shapes.Paste

        End With
    End With
    
    ppObj.Visible = True
    ' Run the show.
    ' ppPres.SlideShowSettings.Run
    
End Sub
 
The more general (better?) soloution is to create the 'chart' in Powerpoint - referencing the data.

The "chart"s in MS (office) Products are are all derived from the same source (applet), the ionly varation is in the interface, due to the vageries of the object model.

If the presentation will be on a system which shares the MS. A. database / recordset, you can just set the reference when building the chart. If not, you can easily export the data to a location which will be vailable to Power Point for the presentation.




MichaelRed


 
I think this thread should reference the original thread:
Transfer an access charts to powerpoint?
thread705-1233422
 
Thanks for replying guys.
Remou, that's exactly what i need, but i have tried all day today and it keeps giving me an error message 2046

Run-time error '2046':
The command or action 'OpenReport' isn't available now.

Thanks
 
OpenReport? I'm baffled. Can you post your code as modified for your purposes?
 
Remou
The error message 2046 was "the command or action 'Copy' isn't available now" sorry for the confusion
and it stops at: DoCmd.RunCommand acCmdCopy
i was reading in microsoft support and it says something about that the form is hidden and it wont make any copy they were giving an alternate solution but this is new for me and i was not be able to fix the error.

Here is the code i have a bunch of charts like 30 generated through different tables and i would like to automate this copy and paste.

Private Sub cmdOK_Click()

Dim ppObj As PowerPoint.Application 'from tek
Dim ppPres As PowerPoint.Presentation 'from tek

' Open up an instance of Powerpoint.
Set ppObj = New PowerPoint.Application 'from tek
Set ppPres = ppObj.Presentations.Add 'from tek

With ppPres
With .Slides.Add(1, ppLayoutTitleOnly)
.Shapes(1).TextFrame.TextRange.Text = "My Chart"
'From Access
DoCmd.OpenForm "IDC"
Forms!IDC.Mychart.SetFocus
DoCmd.RunCommand acCmdCopy
'To PP
.Shapes.Paste
End With
End With
ppObj.Visible = True
' Run the show.
' ppPres.SlideShowSettings.Run
End Sub


Thanks
 
Are your charts available in design view? If so, can we try:

[tt]DoCmd.OpenForm "IDC", acDesign
Set ctl = Forms!IDC("MyChart")
ctl.InSelection = True[/tt]

Instead of:
[tt]DoCmd.OpenForm "IDC"
Forms!IDC.Mychart.SetFocus[/tt]

 
Hi Remou, thanks again for replying

I tried the above suggestion, but it falls in the same error 2046 "the command or action 'Copy' isn't available now"
 
Yes, it works

But i don't know what did i do, and it worked for once, the i kept trying and i realize everytime i get the error message then I get out of the application and the open access again and run the app. it works. do you have any idea why is that?

Thank you very much for replying so far
 
i thing i didn't explaing well

yes a manually copy always works

but also it works running the code you posted, as i said i have to get out of the app. and start to run again.
 
No, I don't really have a idea, as MichaelRed said, this is really starting from the wrong end, but I will try guessing. You do not seem to have added in all the necessary bits for closing the form and so on, that may be one part of the problem. I thought at first that the control was not getting the focus, but I also thought that using design view would fix that. You could try adding:

[tt]MsgBox Screen.ActiveControl.Name[/tt]

Just after
ctl.InSelection = True

To see if the control is getting focus. [ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top