Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to add a title to PowerPoint using a macro

I am using this macro to export QlikView charts to a PowerPoint document.

 

Sub pptTRNN

'An array with the objects you want to export to powerpoint

Dim myArray(21)

myArray(0) = "CH1424"

myArray(1) = "CH1465"

myArray(2) = "CH1428"

myArray(3) = "CH1430"

myArray(4) = "CH1416"

myArray(5) = "CH1414"

myArray(6) = "CH1412"

myArray(7) = "CH1410"

myArray(8) = "CH1408"

myArray(9) = "CH1406"

myArray(10) = "CH1404"

myArray(11) = "CH1402"

myArray(12) = "CH1400"

myArray(13) = "CH1398"

myArray(14) = "CH1396"

myArray(15) = "CH1394"

myArray(16) = "CH1392"

myArray(17) = "CH1390"

myArray(18) = "CH1388"

myArray(19) = "CH3470"

myArray(20) = "CH1386"

myArray(21) = "CH1432"

'Create ppt object

Set PPApp = CreateObject("PowerPoint.Application")


PPApp.Visible = True


Set objPresentation = PPApp.Presentations.Add


'Apply a template if you want one

'objPresentation.ApplyTemplate _

' ("C:\mytemplate.potx")


'For each object in the array create a new slide and paste it.

For each item in myArray


Set PPSlide = objPresentation.Slides.Add(1,11)

Set v=ActiveDocument.GetVariable("PRINT")
v.SetContent "Y",true
ActiveDocument.GetSheetObject(item).restore
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject(item).CopyBitMapToClipboard
ActiveDocument.GetSheetObject(item).minimize
v.SetContent "N",true

PPSlide.Shapes.Paste


Next


'Clean up

Set PPSlide = Nothing

Set PPPres = Nothing

Set PPApp = Nothing

End Sub

It works great but now the user wants to add a title.  I have this expresssion I would like to use.

     If(len(vCustomerName)-0,

     if(isnull([Customer Name]),

     if(isnull([Agent Name Current]),' ',

     [Agent Name Current]),[Customer Name]),vCustomerName)

I would like to know how to code this into the above macro.

0 Replies