HobbitHouse
asked on
Word Object Library question
I have a VB app that pushes some text into a Word doc and prints it. This works just fine under XP with a reference to "Microsoft Word 10.0 Object Library" but when I run it on another machine with Win98 and change the reference to "Microsoft Word 9.0 Object Library" it won't recognize the Word object.
So, as I see it, I have three choices
1) Figure out where the Word 10.0 thing is on the XP machine and copy it over to the 98 machine --- does anyone know, first where to find the Word 10.0 Object Library file (DLL or whatever it is), and second is it likely to work under Win98?
2) Figure out why the Word 9.0 library doesn't recognize the word object --- I haven't a clue how to do this; it seems that it should work as is.
3) Find Bill Gates and hurt him.
Since #3 doesn't seem likely, any help with #1 or #2 will be appreciated.
Thanks for your time.
Paul
So, as I see it, I have three choices
1) Figure out where the Word 10.0 thing is on the XP machine and copy it over to the 98 machine --- does anyone know, first where to find the Word 10.0 Object Library file (DLL or whatever it is), and second is it likely to work under Win98?
2) Figure out why the Word 9.0 library doesn't recognize the word object --- I haven't a clue how to do this; it seems that it should work as is.
3) Find Bill Gates and hurt him.
Since #3 doesn't seem likely, any help with #1 or #2 will be appreciated.
Thanks for your time.
Paul
ASKER
no joy.
the bad news is that I was running a canned set of code that I was given and it works fine on the XP machine, but I don't fully follow the details of what it's doing, so I'm likely missing something else. I've attempted to condense the problem as it now stands into one module for your inspection. Here it is, using your suggestion and showing the error message line
'
' set_up_Word --- instantiate MS Word and set up landscape doc using
' Courier New font
'
Public Sub set_up_Word()
Dim wdApp As Word.Application
Dim strWorkingDocName As String
Dim aThisDoc As Document
Dim range1 As Range
Set wdApp = CreateObject("Word.Applica tion")
wdApp.Documents.Add
strWorkingDocName = wdApp.ActiveDocument.Name
Set aThisDoc = wdApp.Documents(strWorking DocName)
'
' the next line gives a compile error saying "method or data member not found"
'
aThisDoc.PageSetup.Orienta tion = wdOrientLandscape
Set range1 = aThisDoc.Range
range1.Font.Name = "Courier New"
range1.InsertAfter str
End Sub
the bad news is that I was running a canned set of code that I was given and it works fine on the XP machine, but I don't fully follow the details of what it's doing, so I'm likely missing something else. I've attempted to condense the problem as it now stands into one module for your inspection. Here it is, using your suggestion and showing the error message line
'
' set_up_Word --- instantiate MS Word and set up landscape doc using
' Courier New font
'
Public Sub set_up_Word()
Dim wdApp As Word.Application
Dim strWorkingDocName As String
Dim aThisDoc As Document
Dim range1 As Range
Set wdApp = CreateObject("Word.Applica
wdApp.Documents.Add
strWorkingDocName = wdApp.ActiveDocument.Name
Set aThisDoc = wdApp.Documents(strWorking
'
' the next line gives a compile error saying "method or data member not found"
'
aThisDoc.PageSetup.Orienta
Set range1 = aThisDoc.Range
range1.Font.Name = "Courier New"
range1.InsertAfter str
End Sub
ASKER
str is a global document string
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi HobbitHouse,
Try
Public Sub set_up_Word()
Dim wdApp As Object
Dim strWorkingDocName As String
Dim aThisDoc As Document
Dim range1 As Range
Set wdApp = CreateObject("Word.Applica tion")
wdApp.Documents.Add
strWorkingDocName = wdApp.ActiveDocument.Name
Set aThisDoc = wdApp.Documents(strWorking DocName)
'
' the next line gives a compile error saying "method or data member not found"
'
aThisDoc.PageSetup.Orienta tion = wdOrientLandscape
Set range1 = aThisDoc.Range
range1.Font.Name = "Courier New"
range1.InsertAfter str
End Sub
:O)Bruintje
Try
Public Sub set_up_Word()
Dim wdApp As Object
Dim strWorkingDocName As String
Dim aThisDoc As Document
Dim range1 As Range
Set wdApp = CreateObject("Word.Applica
wdApp.Documents.Add
strWorkingDocName = wdApp.ActiveDocument.Name
Set aThisDoc = wdApp.Documents(strWorking
'
' the next line gives a compile error saying "method or data member not found"
'
aThisDoc.PageSetup.Orienta
Set range1 = aThisDoc.Range
range1.Font.Name = "Courier New"
range1.InsertAfter str
End Sub
:O)Bruintje
ASKER
that did the trick. many thanks.
glad you got it! :)
ASKER
bruntjie, thanks for your time as well
ie:
Dim wdApp as Word.Application
set wdApp = CreateObject("Word.Applica
then it won't matter won't version of word you have on your computer.