Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
My task is select a particular value of field, select a particular chart and paste it in a presentation. everything works fine, except my sheet does not get refreshed for a selected value of a field.
to me looks like probelm is in the highlighted row (bold and underlined).
I am getting same chart on all slides.
sub change_filter
ActiveDocument.Sheets("SH05").Activate
ActiveDocument.GetApplication.WaitForIdle
'Settings
set obj = ActiveDocument.GetSheetObject("CH23")
'Set object width and height
set fr = obj.GetFrameDef
set pos = fr.Rect
pos.Width = pos.width * 1.2
pos.Height = pos.Height * 1.6
obj.SetFrame fr,true,""
ActiveDocument.ActiveSheet.FitZoomToWindow
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets
Set PPApp = CreateObject("PowerPoint.Application")
PPApp.Visible = True
'File_Name = PPApp.GetOpenFilename("All Files (*.*),*.*",,"Select file",False)
Set PPres = PPApp.Presentations.Open("C:\Users\dipak.b.patel\Desktop\Template for Qlik.pptx")
PPSlideNo = 2
DIM fname
SET f = ActiveDocument.Variables("vfName")
fname = f.GetContent.STRING
msgbox(fname)
ActiveDocument.Fields(fname).Clear
SET Field = ActiveDocument.Fields(fname).GetPossibleValues
FOR i=0 to Field.Count-1
ActiveDocument.Fields(fname).Clear
Capab = Field.Item(i).Text
ActiveDocument.FIelds(fname).Select Capab
ActiveDocument.GetApplication.WaitForIdle
'msgbox(Field.Item(i).Text)
Set PPSlide = PPres.Slides.Add(PPSlideNo,2)
msgbox "slide added " & i
PPSlide.Shapes(2).Delete ' removes the text box
PPSlide.Shapes(1).TextFrame.TextRange = Capab
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH23").CopyBitmapToClipboard
PPSlide.Shapes.Pastespecial(3)
with PPSlide.Shapes(PPSlide.Shapes.Count)
.left = 11
.top = 144
.height = 360
end with
'activedocument.nexttab
PPSlideNo = PPSlideNo + 1
next
'PPres.SaveAs "C:\Presentation1.ppt"
'PPres.Close
'PPApp.Quit
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
set fr = obj.GetFrameDef
set pos = fr.Rect
pos.Width = pos.width / 1.2
pos.Height = pos.Height / 1.6
obj.SetFrame fr,true,""
end sub
Any suggestions?