Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.
Public Sub PrintMMDoc_MS_Word(ByVal strMMDataDir As String, ByVal strMMDataFile As String, ByVal strMMDocDir As String, ByVal strMMDDocFile As String) '2007-06-03 Ted Palmer 'Dim wrdApp As Word.Application: Instantiated in class frmLogin >> cmdLogin_Click event. 'Closed & Disposed in class MainMDIFrame >> Closing event go_wrdApp.Visible = True '2007-05-24 Ted Palmer 'This Try-Catch block uses MailMerge functionality of "Word.Application" to print an instance 'of the MS-word document passed as a parameter to this subroutine and 'the MailMerge data file passed as a parameter to this subroutine. Try 'Open an existing MailMerge Main document. Dim wrdDoc As Object go_wrdApp.ChangeFileOpenDirectory(strMMDocDir) wrdDoc = go_wrdApp.Documents.Open(FileName:=strMMDDocFile) '<-- MS-Word MailMergeMain document wrdDoc.MailMerge.MainDocumentType = 0 wrdDoc.MailMerge.OpenDataSource(Name:= _ strMMDataDir & strMMDataFile, ConfirmConversions:=False, _ ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _ WritePasswordTemplate:="", Revert:=False, Format:=0, _ Connection:="", SQLStatement:="", SQLStatement1:="", SubType:=0) With wrdDoc.MailMerge .Destination = 0 .SuppressBlankLines = True With .DataSource .FirstRecord = 1 .LastRecord = -16 End With .Execute(Pause:=False) End With Catch ex As Exception MessageBox.Show("In Module MainModule >> Sub PrintMMDoc, there was an Error in the MailMerge process. " _ & "YOU the user probably caused this exception by closing the Microsoft Word application frame. " _ & "Please don't do this again. You probably did this during the Print Preview process. During that process. " _ & "you must close the MS-Word document and the MS-Word MailMerge Main document, but not the application frame. " _ & "When closing the MailMerge Main document, you will see 2 small x(s) in the upper right corner of the application " _ & "frame. Click ONLY the bottom x. Then minimize the application frame. To recover from this condition " _ & "and restore the printing subsystem, you must exit the AutoSubrogate(TM) program and restart it again. " _ & "Please save your work and restart the AutoSubrogate(TM) program now: " & ex.Message, _ "AutoSubrogate(TM) Exception:", MessageBoxButtons.OK, MessageBoxIcon.Stop) End Try End Sub 'PrintMMDoc_MS_Word
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.