Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
is necessary to run a macro that captures the value of number2 is my variable and locate for the execution of the pdf document
but I can not take the value ( vReport 😃
vReport =
Sub DispName
set Name1 = ActiveDocument.Variables("vName")
set Name2 = ActiveDocument.Variables("vAvlName")
GetUserName = Name1.GetContent.String
Name2.SetContent GetUserName , true
End Sub
Sub Createpdf
Call DispName
set Name1 = ActiveDocument.Variables("vName")
set Name2 = ActiveDocument.Variables("vAvlName")
GetUserName = Name1.GetContent.String
Name2.SetContent GetUserName , true
vReport = Name2 'Set report error cod because I do not know
'vReport = "RP01" 'Set report
vName = " Reporte1" 'Name of output pdf
ActiveDocument.PrintReport(vReport), "Bullzip PDF Printer", false 'Printreport
reportFile = "C:\BI Reports Tranza\Prueba\" & vName &".pdf" 'Setting outputname
MyPrintPDFWithBullZip(Reporte1) 'Call pdf printer
ActiveDocument.GetApplication.Sleep 5000
' mailrapport
' ActiveDocument.S
ActiveDocument.GetApplication.Sleep 5000
ActiveDocument.GetApplication.Quit
Call Print_PDF
End sub
Sub Print_PDF(FieldValue, ReportName, ReportID)
' Designed for early bind, set reference to PDFCreator
Dim pdfjob
Dim sPDFName
Dim sPDFPath
DIM attachment
'/// Change the output file name here! ///
sPDFName = sPDFName & " - " & FieldValue
sPDFPath = "C:\BI Reports Tranza\Prueba\" 'here goes the complete past where you want to store your pdf
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
If .cStart("/NoProcessingAtStartup", True) = False Then
Exit Sub
End if
.cVisible = True
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
' Print the QlikView Report
ActiveDocument.PrintReport ReportID, "PDFCreator"
'Wait until the print job has entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 1
ActiveDocument.GetApplication.Sleep 20
' in VBScript use WScript.Sleep(20)
Loop
pdfjob.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until pdfjob.cCountOfPrintjobs = 0
ActiveDocument.GetApplication.Sleep 20
' in VBScript use WScript.Sleep(20)
Loop
pdfjob.cClose
Set pdfjob = Nothing
'''''''''Uncomment this if you want to send an email for each pdf documetn created!!!!!!!'''''''
'attachment = sPDFPath&"\"&sPDFName&".pdf"
'EmailReport attachment, sPDFName
''''''''''
End Sub
Sub pro
SET Button = ActiveDocument.GetSheetObject("BU01")
Button.Press
End sub
I assume it's a syntax issue, try this:
vReport = Name2.GetContent.String
or
vReport = Name2.String
or
vReport = GetUserName
- Marcus