How to Export Chart from FORM to PPT (1 Viewer)

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
Hi There,

Greetings.. :)

let me introduce myself I was working in telco for 10 years, and mostly everyday i used access to analyze my Data, like collect the raw data put in in SQL Server, and Process the Table and Chart by Form in Access,

after I was promoted to be a leader in my team, now I am more of a process chart in PPT I took away from my access tools

MyQuestion :
is there any way to make one button to export ALL the chart from my Form to PPT.

Could someone helping me how is the idea and share the VBA Code and the steps by steps

kindly Pls find attach the following tools I often use and sample PPT File and Daily Counter.

how to used my tools

1. click import, and select excel file,
2. select the working set name, later on select the date
date before is from 12/29 00 - 12/30 23 date after is 12/31 00 - 01/01 23
or you see the Pic i have attach.
3. click generate chart.

thanks very much for this forum so much helping to build and learn access specially for beginner like me

Brs
AN
 

Attachments

  • Report.zip
    1.3 MB · Views: 249
  • tools access.png
    tools access.png
    78.2 KB · Views: 244
Last edited:

Cronk

Registered User.
Local time
Tomorrow, 10:05
Joined
Jul 4, 2013
Messages
2,770
Right now I don't have access to the version of Access you are using and cannot open your database.

I've never had to do what you are wanting to achieve so I have no code to share.

However, I'd be inclined to save your graphs as pdf files and link the the PowerPoint slides to these files.

Having set the PPT file up manually, have Access generate updated graph files programmatically and save them on top of the old files.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:05
Joined
Feb 28, 2001
Messages
27,001
While in theory it is possible to open a PowerPoint application object, the issue I have had in the past is that the slide collection is a bit difficult to manage because of the variability of the internal structure exposed by the Component Object Model. Yes, PowerPoint uses COM. But no, it isn't an intuitive structure. Slides can have more than one working area (frame) and the frames can be different sizes and can be almost anywhere on the slide.

I know you want to automate it, but PowerPoint isn't only about displaying something - it is also about PLACING something in the right place on the right slide.

I'm thinking that you might find it easier to do this as a two-part process. First export whatever as a file. THEN import it from the PowerPoint application and place it.
 

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
HI,

I have tried to downgrade the version in .MDB for access 2000 above but unfortunately can't downgrade from high version to lowest one because I have start the tools from Access 2016. :confused:

Right now I don't have access to the version of Access you are using and cannot open your database.

I've never had to do what you are wanting to achieve so I have no code to share.

However, I'd be inclined to save your graphs as pdf files and link the the PowerPoint slides to these files.

Having set the PPT file up manually, have Access generate updated graph files programmatically and save them on top of the old files.
 

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
Hi bro, Do you have any idea how is the VBA Code if my plan just export the chart from Access FORM to directory Drive "C" or "D" as aPicture
or any Sample code.

While in theory it is possible to open a PowerPoint application object, the issue I have had in the past is that the slide collection is a bit difficult to manage because of the variability of the internal structure exposed by the Component Object Model. Yes, PowerPoint uses COM. But no, it isn't an intuitive structure. Slides can have more than one working area (frame) and the frames can be different sizes and can be almost anywhere on the slide.

I know you want to automate it, but PowerPoint isn't only about displaying something - it is also about PLACING something in the right place on the right slide.

I'm thinking that you might find it easier to do this as a two-part process. First export whatever as a file. THEN import it from the PowerPoint application and place it.
 

JHB

Have been here a while
Local time
Tomorrow, 00:05
Joined
Jun 17, 2012
Messages
7,732
..
MyQuestion :
is there any way to make one button to export ALL the chart from my Form to PPT.
..
Yes it can be done, try the attachment. Change the below line in the code to the path where the Powerpoint file exist.
Code:
  PowerPoint.Presentations.Open ("[B][COLOR=Red]C:\Access programmer\[/COLOR][/B][COLOR=Red][COLOR=Black]Præsentation12.ppt[/COLOR][/COLOR]")
 

Attachments

  • Create a graph in Powerpoint from MS-Access.zip
    407.7 KB · Views: 296

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
Hi Mate,

I do not know what to be grateful, very pleased to be turned out to be 100% thank you very much for your help. I would make it more presentable again and I will share. Once again, thank you


Yes it can be done, try the attachment. Change the below line in the code to the path where the Powerpoint file exist.
Code:
  PowerPoint.Presentations.Open ("[B][COLOR=Red]C:\Access programmer\[/COLOR][/B][COLOR=Red][COLOR=Black]Præsentation12.ppt[/COLOR][/COLOR]")
 

JHB

Have been here a while
Local time
Tomorrow, 00:05
Joined
Jun 17, 2012
Messages
7,732
You're welcome, good luck
 

JHB

Have been here a while
Local time
Tomorrow, 00:05
Joined
Jun 17, 2012
Messages
7,732
In connection with an answer in another thread, I came up with another solution, so simple that it almost hurts, (as we say in my language).
I'm sure it would interest you, antonyel.
 

Attachments

  • Create a graph in Powerpoint from MS-Access.zip
    410.7 KB · Views: 299

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
Hi Mate....

really cool, awesome... and when i change the code with
"PowerPoint.ActiveWindow.View.PasteSpecial ppPasteEnhancedMetafile"
it will copy as pic, so i have 2 options right now as a Data and Clickable and as a Pic really really cools mate.. thanks very much.. you ar genius


the first one it also cool but its was really difficult because the way you made the chart is stored in Memory and copy it to Graph in PPT.

btw Thanks Very Again..


PowerPoint.ActiveWindow.Presentation.Slides(SlideNo).Shapes.Paste
'PowerPoint.ActiveWindow.View.PasteSpecial ppPasteEnhancedMetafile
SlideNo = SlideNo + 1
Set shpGraph = PowerPoint.ActivePresentation.Slides.Add(SlideNo, ppLayoutBlank)

In connection with an answer in another thread, I came up with another solution, so simple that it almost hurts, (as we say in my language).
I'm sure it would interest you, antonyel.
 

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
Hi Mate,

could you help explained me what is the meaning for this Code
what is ControlType = 113

If Me.Controls(x).ControlType = 113 Then '"MSGraph.Chart"

Many Thanks

In connection with an answer in another thread, I came up with another solution, so simple that it almost hurts, (as we say in my language).
I'm sure it would interest you, antonyel.
 

JHB

Have been here a while
Local time
Tomorrow, 00:05
Joined
Jun 17, 2012
Messages
7,732
..
could you help explained me what is the meaning for this Code
what is ControlType = 113
If Me.Controls(x).ControlType = 113 Then '"MSGraph.Chart"
As it mention in the comments, (red text), a graph/chart control type, like you've a control type for a combobox, listbox, textbox etc.
 

sneuberg

AWF VIP
Local time
Today, 16:05
Joined
Oct 17, 2014
Messages
3,506
As it mention in the comments, (red text), a graph/chart control type, like you've a control type for a combobox, listbox, textbox etc.

As an aside there doesn't seem to be a constant name for this like there is for other controls, e.g., acTextBox, acTextBox, etc. If you open the Object Browser and click on AcControlType and you can see all of the constants. When you click on the constants the number is shown at the bottom. None of them is assigned 113.
 

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
I see Got it.. thanks Mate

As it mention in the comments, (red text), a graph/chart control type, like you've a control type for a combobox, listbox, textbox etc.
 

antonyel

Registered User.
Local time
Tomorrow, 06:05
Joined
Jan 6, 2017
Messages
18
HI Mate,

I have tried to make a Picture Border (line Black/Blue), and put the code wich is highligh RED but still error could anybody help how to make the border line.

Many Thanks

SlideNo = 1
Set PowerPoint = CreateObject("PowerPoint.Application")
PowerPoint.Visible = True
PowerPoint.Presentations.Open ("C:\Access programmer\Præsentation12.ppt")
DoCmd.Echo False
For x = 0 To Me.Controls.Count - 1
If Me.Controls(x).ControlType = 113 Then '"MSGraph.Chart"
Me.Controls(x).SetFocus
DoCmd.RunCommand acCmdCopy
DoEvents
PowerPoint.ActiveWindow.Presentation.Slides(SlideNo).Shapes.PasteSpecial ppPasteEnhancedMetafile
'PowerPoint.ActiveWindow.View.PasteSpecial ppPasteEnhancedMetafile
SlideNo = SlideNo + 1
shpGraph.Borders.OutsideLineStyle = wdLineStyleSingle
Set shpGraph = PowerPoint.ActivePresentation.Slides.Add(SlideNo, ppLayoutBlank)
DoEvents
End If
Next
PowerPoint.ActivePresentation.Slides(SlideNo).Delete
DoCmd.Echo True
End Sub
 

JHB

Have been here a while
Local time
Tomorrow, 00:05
Joined
Jun 17, 2012
Messages
7,732
To add a border around it, use the below code:
Code:
  Dim PowerPoint As PowerPoint.Application
  Dim x As Integer, SlideNo As Integer

  SlideNo = 1
  Set PowerPoint = CreateObject("PowerPoint.Application")
  PowerPoint.Visible = True
  PowerPoint.Presentations.Open ("C:\Access programmer\Præsentation12.ppt")
  DoCmd.Echo False
  For x = 0 To Me.Controls.Count - 1
    If Me.Controls(x).ControlType = 113 Then '"MSGraph.Chart"
      Me.Controls(x).SetFocus
      DoCmd.RunCommand acCmdCopy
      DoEvents
      PowerPoint.ActiveWindow.Presentation.Slides(SlideNo).Shapes.Paste
      PowerPoint.ActiveWindow.Presentation.Slides(SlideNo).Shapes.Item(1).Line.ForeColor.RGB = vbBlack
      PowerPoint.ActiveWindow.Presentation.Slides(SlideNo).Shapes.Item(1).Line.Weight = 1.5
      PowerPoint.ActiveWindow.Presentation.Slides(SlideNo).Shapes.Item(1).Line.Visible = True
      SlideNo = SlideNo + 1
      PowerPoint.ActivePresentation.Slides.Add SlideNo, ppLayoutBlank
      DoEvents
    End If
  Next
  PowerPoint.ActivePresentation.Slides(SlideNo).Delete
  DoCmd.Echo True
 

MichealDon

Registered User.
Local time
Today, 16:05
Joined
Nov 25, 2017
Messages
29
Dear All,
I have a database, at the report with some pictures to be inserted from path of picture fields. (the folder of pics come together with the database folder)
Currently, the report is exported to .pdf format daily, but now for the purpose of presentation everyday. So I should export the report to .pptx format (powerpoint).
I do not know how to make it to powerpoint format.
Thank you for your help.
MichealDon
 

isladogs

MVP / VIP
Local time
Today, 23:05
Joined
Jan 14, 2017
Messages
18,186
Have you looked at the examples uploaded by JHB earlier in this thread?
 

Users who are viewing this thread

Top Bottom