Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have this macro code that i build by my own, but its not working and its not showing any error message.
the functioning of the program is this:
The program will loop through “Value_Indicator” filed (it has 4 values) and inside each of them will loop through Region’s field (with 11 values). In the meantime when QV is Looping will export every object into a template then change the name of the file for one inside QV save the PTT and close it. Finally with a msgbox print in the screen the path where the file is.
Do you have any idea about what is wrong?
this is the code:
Sub fristTryDeck
SET x=ActiveDocument.Fields("Value_Indicator").GetPossibleValues
SET y=ActiveDocument.Fields("Region").GetPossibleValues
For u=0 to x.count-1
'msgbox(x.Item(u).Text)
ActiveDocument.Fields("Value_Indicator").Select x.item(u).Text
For i=0 to y.count-1
ActiveDocument.Fields("Region").Select y.item(i).Text
'msgbox(y.Item(i).Text)
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Presentations.Open "C:PathTemplate\fileName.pptx"
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
PPSlideNo = 1
'For i = 0 to activedocument.noofsheets -1
Set PPSlide = objPresentation.Slides.Add(PPSlideNo,12)
'ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ActiveSheet.CopyBitmapToClipboard
PPSlide.Shapes.Paste
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
'activedocument.nexttab
'PPSlideNo = PPSlideNo + 1
'NEXT
Next
Next
SET DVA=ActiveDocument.Variables("vDn")
getVariabe = DVA.GetContent.String
filePath = "C:PathTemplate\fileName.pptx"
objPPT.ActivePresentationSaveAs filePath
objPPT.ActivePresentation.Close
popFinal = "Document completed in folder: " + filePath
msgbox popFinal
End Sub
The outcome is this:
Any idea?
Thanks in advanced.
See if the below link will help to resolve your issue: