![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have had this set up and working for a long time. perfect until now. I am assuming a microsoft update of some kind. Set WordDoc = wordApp.Documents.Open(strDocName) this now says there is no object Where is wordApp defined and opened? That's the part that must be broken. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Function RidesMergeWord(strDocName As String, strDataDir As String, adrastring As String) Debug.Print strDataDir Dim wordApp As Word.Application Dim WordDoc As Word.Document Dim strActiveDoc As String Dim lngWordDest As Long On Error GoTo CreateWordApp Set wordApp = GetObject(, "Word.Application") On Error Resume Next Set WordDoc = wordApp.Documents.Open(strDocName) strActiveDoc = wordApp.ActiveDocument.Name WordDoc.MailMerge.OpenDataSource _ Name:=strDataDir & TextMerge, _ ConfirmConversions:=False, _ ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _ WritePasswordTemplate:="", Revert:=False, Format:=0, _ Connection:="", SQLStatement:="", SQLStatement1:="" With WordDoc.MailMerge .Destination = 0 .MailAsAttachment = False .MailAddressFieldName = "" .MailSubject = "" .SuppressBlankLines = True With .datasource .FirstRecord = 1 ' End With .Execute Pause:=True End With 'MyPbar.IncOne ' step 4, doc is merged WordDoc.Close (False) wordApp.Windows(wordApp.Windows.count).Activate Set WordDoc = wordApp.ActiveWindow.Document Call WordDoc.SaveAs(adrastring, FileFormat:=wdFormatDocument) Debug.Print "filename: " & WordDoc.Name ''''''''''''''''''''''' Call WordDoc.PrintOut(Background:=False) Call wordApp.Quit(savechanges:=False) Set wordApp = Nothing Set WordDoc = Nothing ' Set MyPbar = Nothing DoEvents Exit Function CreateWordApp: Set wordApp = CreateObject("Word.Application") Resume Next End Function Function RidesEditTemplate(strWordDoc As String, strSaveDir As String) Dim wordApp As Object Dim WordDoc As Object clsRidesPBar.ShowProgress clsRidesPBar.TextMsg = "Launching Word...please wait..." On Error GoTo CreateWordApp Set wordApp = GetObject(, "Word.Application") On Error GoTo 0 Set WordDoc = wordApp.Documents.Open(strWordDoc) wordApp.Visible = True '*- WordDoc.MailMerge.MainDocumentType = 0 ' wdFormLetters = 0 WordDoc.MailMerge.OpenDataSource _ Name:=strSaveDir & TextMerge, _ ConfirmConversions:=False, _ ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _ WritePasswordTemplate:="", Revert:=False, Format:=0, _ Connection:="", SQLStatement:="", SQLStatement1:="" wordApp.Activate wordApp.WindowState = 0 clsRidesPBar.HideProgress Exit Function CreateWordApp: Set wordApp = CreateObject("Word.Application") Resume Next End Function |
#5
| |||
| |||
|
|
sparks wrote: I have had this set up and working for a long time. perfect until now. I am assuming a microsoft update of some kind. Set WordDoc = wordApp.Documents.Open(strDocName) this now says there is no object Where is wordApp defined and opened? That's the part that must be broken. |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
I have had this set up and working for a long time. perfect until now. I am assuming a microsoft update of some kind. Set WordDoc = wordApp.Documents.Open(strDocName) this now says there is no object |
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |