|
-
Jul 14th, 2003, 03:35 AM
#1
Thread Starter
Lively Member
Word Automation Problems
Hi,
I have an application that using word automation to create a word document. I have referenced the word 8.0 object library and the application works fine on a machine with office 97 installed.
However I have installed the application on a machine with office 2000 and XP and it does not work. Does anyone know how I can configure my application to work with all version of word.
Note: I am not doing anything complicated with the word document and all feature should be availble in all version of word.
Thanks for your help,
Chris
-
Jul 14th, 2003, 04:02 AM
#2
Fanatic Member
remove the reference and try this:
VB Code:
Option Explicit
Public objWord As Object 'instead of Word.Application
Public wd As Object 'instead of Word.Document
Private Sub Command1_Click()
If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application")
Else
Set objWord = GetObject(, "Word.Application")
End If
DoEvents
Set wd = objWord.Documents.Open("c:\Test.doc")
'here u can do stuff with the document
'using the wd object
'adding some text to it
wd.ActiveWindow.Selection.TypeText "ABCDEFGH peet was here ! :-)"
'when finished manipulating the document, u can show it To the user
objWord.Visible = True
'quit word
If Not (wd Is Nothing) Then Set wd = Nothing
If Not (objWord Is Nothing) Then objWord.Application.Quit
If Not (objWord Is Nothing) Then Set objWord = Nothing
End Sub
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
-
Jul 21st, 2003, 10:32 PM
#3
-= B u g S l a y e r =-
Originally posted by robbedaya
remove the reference and try this:
VB Code:
.....
'adding some text to it
wd.ActiveWindow.Selection.TypeText "ABCDEFGH peet was here ! :-)"
...
wow.. I was there ! :-D
-
Jul 22nd, 2003, 03:55 AM
#4
Fanatic Member
yep, i saw this tread and i knew i saw a post of you in another thread that was usefull. And because it wos your code, i didn't remove your name.
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|