Run Time Error 438 - Object doesn't support the property or method
All the calls to Word objects from Excel run except the
run time error 438 on Line: Selection.TypeText Text:=Labels(i - 1) This line functions if ececuted within a Word thread. For i = 1 To MaxLabelCount LabelModCount = i Mod 80 If LabelModCount = 1 Then LabelDocCount = LabelDocCount + 1 If LabelDocCount 1 Then Application.PrintOut Filename:="", Range:=wdPrintAllDocument, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _ Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _ PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0 Call CloseWordDocument End If Call OpenWordDocument(LabelDocCount) Windows(1).Activate End If LabelRowPos = i Mod 4 If LabelRowPos = 1 Then If Not LabelModCount = 1 Then Selection.MoveRight Unit:=wdCell End If Else Selection.MoveRight Unit:=wdCell Selection.MoveRight Unit:=wdCell End If Selection.TypeText Text:=Labels(i - 1) Next Application.PrintOut Filename:="", Range:=wdPrintAllDocument, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _ Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _ PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0 Call CloseWordDocument Exit Sub ErrorReturn: Exit Sub End Sub Sub CloseWordDocument() ' ' CloseWordDocument Sub ' Sub Created 9/6/2004 by Paul Cottier ' ActiveDocument.Close End Sub Sub OpenWordDocument(DocNum As Integer) ' ' OpenWordDocument Sub ' Sub recorded 9/6/2004 by Paul Cottier ' Dim docname As String docname = TargetName & CStr(DocNum) ChangeFileOpenDirectory _ ApplicationFolder Documents.Open Filename:=docname, ConfirmConversions:=False, ReadOnly _ :=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _ :="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _ , Format:=wdOpenFormatAuto End Sub |
All times are GMT +1. The time now is 05:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com