Hallo allen,
enige tijd geleden heb ik dit gemaakt:
http://www.helpmij.nl/forum/showthread.php/901001-Word-document-opslaan-als-PDF-en-mailen/page2
Nu was het simpel aanpassen naar het printen van het document.
Nu zou ik alleen een extra functionaliteit willen toevoegen aan het document, namelijk een printpreview vanuit het Userform
Het toevoegen van ActiveDocument.PrintPreview werkt opzich, maar dan kan je er niet doorheen scrollen.
Als iemand het document heeft bekeken, dan moet er de vraag komen: akkoord? Ja = Printen en opslaan als PDF op locatie naar keuze, Nee = naar het userform en aanpassen.
Jullie een idee
De code van de knop:
Jullie een idee/tip?
enige tijd geleden heb ik dit gemaakt:
http://www.helpmij.nl/forum/showthread.php/901001-Word-document-opslaan-als-PDF-en-mailen/page2
Nu was het simpel aanpassen naar het printen van het document.
Nu zou ik alleen een extra functionaliteit willen toevoegen aan het document, namelijk een printpreview vanuit het Userform
Het toevoegen van ActiveDocument.PrintPreview werkt opzich, maar dan kan je er niet doorheen scrollen.
Als iemand het document heeft bekeken, dan moet er de vraag komen: akkoord? Ja = Printen en opslaan als PDF op locatie naar keuze, Nee = naar het userform en aanpassen.
Jullie een idee
De code van de knop:
Code:
Private Sub btnVerzend_Click()
Dim olkApp As Object
Dim ct As Control
Dim docVar As Variable
Dim shp As InlineShape
Dim i As Integer
Dim ctl
For Each ct In Controls
If TypeName(ct) = "TextBox" Then ActiveDocument.Variables(ct.Name) = IIf(ct.Text = "", " ", ct.Text)
If TypeName(ct) = "CheckBox" Then ActiveDocument.Variables(ct.Name) = IIf(ct.Value = 0, 0, 1)
If TypeName(ct) = "ComboBox" Then
Select Case ct.Name
Case "cboBehoefte"
ActiveDocument.Variables(ct.Name).Value = IIf(Me.cboBehoefte.Value = "", " ", Me.cboBehoefte.Value)
Case "cboOpdrOpties"
ActiveDocument.Variables(ct.Name).Value = IIf(strOpdrOpties = "", " ", strOpdrOpties)
Case "cboOpdreenheid"
ActiveDocument.Variables(ct.Name).Value = IIf(Me.cboOpdreenheid.Value = "", " ", Me.cboOpdreenheid.Value)
End Select
End If
Next
ActiveDocument.Fields.Update
ActiveDocument.PrintPreview
Dim strMsg As String
Dim strTitle As String
' Dialog Message
strMsg = "Is het zo goed?" & vbCrLf & ""
' Dialog's Title
strTitle = "Sluiten"
'Display MessageBox
Ret_type = MsgBox(strMsg, vbYesNo + vbQuestion, strTitle)
' Check pressed button
Select Case Ret_type
Case 6
Application.Quit
Case 7
If ActiveDocument.FullName <> "" Then
ActiveDocument.SaveAs2
'
'Silent Save_to_PDF Macro
'
ActiveDocument.ExportAsFixedFormat OutputFileName:="H:\ " & Me.txtNaam & ".pdf", _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, Item:= _
wdExportDocumentContent, IncludeDocProps:=False, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
End If
MsgBox "De overeenkomst is in tweevoud naar de printer gestuurd." & vbCrLf & vbCrLf & "Dit document wordt nu afgesloten."
' For Each ctl In Me.Controls
' If TypeOf ctl Is MSForms.TextBox Then
' ctl.Text = ""
' End If
' Me.cboBehoefte.Value = Null
' Me.cboOpdreenheid.Value = Null
' Me.cboOpdrOpties.Value = Null
' Next ctl
Unload Me
ActiveDocument.Close
Unload Me
End Sub
Jullie een idee/tip?