Private Sub howtoconvertwordtopdf()
'Option Explicit
' Dim myWord As Word.Application
' Dim myDoc As Word.Document
' Dim OriginalPrinter As String
'
' Set myWord = New Word.Application
'
' Set myDoc = myWord.Documents.Open("your_document_name")
' OriginalPrinter = myWord.ActivePrinter
' myWord.ActivePrinter = "PDFWriter"
' myDoc.PrintOut
' myWord.ActivePrinter = OriginalPrinter
' myDoc.Close (False)
' myWord.Quit
' Set myWord = Nothing
End Sub
'Module for creating PDF file automatically from Crystal Report
Private Sub exporttopdf(repname As String)
' Crystal Report Viwer in the form is made visible enabled and required options set
CRVReport.Visible = True
With crxrpt.ExportOptions
.DestinationType = crEDTDiskFile
.FormatType = crEFTPortableDocFormat
.DiskFileName = App.Path & "\" & repname & ""
End With
On Error GoTo ER
crxrpt.Database.Tables(1).SetLogOnInfo "odbcsource", strDBNameOrPath, strUserID, strPassword
crxrpt.Export False
cmdclose.Visible = True
CRVReport.Top = 20
CRVReport.Left = 20
CRVReport.Height = Me.Height - 1000
CRVReport.Width = Me.Width - 200
cmdclose.Top = CRVReport.Top + CRVReport.Height + 100
cmdpdf.Top = CRVReport.Top + CRVReport.Height + 100
Exit Sub
ER:
MsgBox "Database Busy to access , try some other report and come back"
Exit Sub
End Sub