Automation w/WORD 97 - Simple example needed 
Author Message
 Automation w/WORD 97 - Simple example needed

I need, in VB5 simple code, an example that will open "c:\test.doc", enter the
text "hi mom" and quit.

Thanks,
ian



Sun, 27 Aug 2000 03:00:00 GMT  
 Automation w/WORD 97 - Simple example needed

Quote:

> I need, in VB5 simple code, an example that will open "c:\test.doc", enter the
> text "hi mom" and quit.

> Thanks,
> ian

Hope this helps:

public objWord as word.application
public MomDoc as document

sub WriteHiMom
        ' GetWord function is below this code
        if not GetWord then exit sub

        on error resume next
        set MomDoc=objWord.Documents.Open("c:\test.doc")
        if err then
                '  Doc not found error handler
                exit sub
        end if
        on error goto 0

        objWord.Selection.TypeText "Hi Mom"

        objWord.quit
end sub

Public Function GetWord() As Boolean
  '
  ' This method gets an current instance of Word if one is running,
  ' otherwise it creates an instance
  '
  On Error Resume Next
    Set objWord = GetObject(, "Word.Application")

    If Err.Number <> 0 Then
      Err.Clear
      Set objWord = CreateObject("Word.Application")
      GetWord = True
      Exit Function
    End If

  If Err.Number <> 0 Then
    GetWord = False
    MsgBox "Microsoft Word Not Found"
  Else
    GetWord = True
  End If

End Function



Sun, 27 Aug 2000 03:00:00 GMT  
 Automation w/WORD 97 - Simple example needed

Quote:

> I need, in VB5 simple code, an example that will open "c:\test.doc", enter the
> text "hi mom" and quit.

> Thanks,
> ian

My company North Star Micro, can and will create that or any funtion you

problem.

generally a piece of code like that will cost $50 - $75

thanks

Jim Rodimon
associate



Sun, 27 Aug 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Access 97 to Word 8.0 Automation Help Needed

2. Automation seems to hang with Access 97 / Word 97

3. Automation Error when automating Word 97 from Access 97

4. Sending text to Word 97 from Access 97 using OLE automation

5. Help Needed - Passing Value from Access 97 to Word 97 Macro

6. Printing docs thru Word 97 using VB/DDE - an example

7. New to automation - a couple questions - MS Word 97

8. Access 97: How do I edit an embedded Word object through automation

9. Office 97 Access to Word Automation

10. Probleme Automation avec Access97 et Word 97

11. Access 97 Automation - Integration with Word

12. Access 97 to Word Mail Merge Automation

 

 
Powered by phpBB® Forum Software