Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI ALL,
I want to export objects to .pptx.
The results are build on the selection of listbox or any graph.
For example:
ActiveDocument.Fields("Year").Select("2013")
ActiveDocument.Fields("Quarter").Select("Q3")
output the result satisfied the condition "2013" and "Q3".
The result may be any graph such as Gauge that display the gross profit in 2013 Q3.
how can i do?
Thanks.
Amy
Hi,
just add two QV Variables (Settings-->Variable Overview-->Add)
vTest1=GetFieldSelections(Year)
vTest2=GetFieldSelections(Quarter)
then add following code to module and adjust path of export and ObjectID of your Chart:
Sub Exportppt
SET Doc = ActiveDocument
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True ' Create a presentation
Set PPPres = PPApp.Presentations.Add
Set PPSlide = PPPres.Slides.Add(1, 1)
PPSlide.Shapes(1).Delete ' removes the title
PPSlide.Shapes(1).Delete ' removes the text box
set v=ActiveDocument.Variables("vTest1")
getVariable1 = v.GetContent.String
set w=ActiveDocument.Variables("vTest2")
getVariable2 = w.GetContent.String
ActiveDocument.Fields("Year").select getVariable1
ActiveDocument.Fields("Quarter").select getVariable2
ActiveDocument.GetSheetObject("CH01").CopyBitmapToClipboard ' Please adjust the ObjectID
ActiveDocument.GetApplication.WaitForIdle
with PPSlide.Shapes.PasteSpecial(1)
end with
filePath = "C:\Users\Admin\Desktop\Export.pptx" 'Please adjust according to your local environment
PPApp.ActivePresentation.SaveAs filePath
end sub
and finally take care that you setup security correctly
hope this helps