Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Feb 21, 12:10*am, Mike H wrote:
Hi, You weren't seeing an error because your error handler was doing what you told it to do and handling the error Sub Write_to_Word() Dim objApp As Object On Error Resume Next Set objApp = GetObject(, "Word.Application") If Err.Number < 0 Then * * On Error GoTo ErrHandler * * Set objApp = CreateObject("Word.Application") Else * * 'Bound to instance, activate error handling * * On Error GoTo ErrHandler End If With objApp * * * * .Visible = True * * * * .Documents.Add * * * * .Selection.Font.Name = "Arial" * * * * .Selection.TypeText "Hello" * * * * .Selection.TypeParagraph * * * * .Selection.TypeText Text:="Hello 2" * * End With Set objApp = Nothing Exit Sub ErrHandler: 'Release the object and resume normal error handling Set objApp = Nothing On Error GoTo 0 'Display standard run time error message box End Sub -- Mike Thanks very much Mike - it works beautifully !!! AP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Write text to a table in Word | Excel Programming | |||
Write in word OLE object | Excel Programming | |||
HOW PUT WORD-ART IN THE BACKGROUND AND WRITE OVER IT | Excel Worksheet Functions | |||
write to word | Excel Programming | |||
How to write in Word w/o Reference | Excel Programming |