Solved

Word Object Library question

Posted on 2002-05-24
8
213 Views
Last Modified: 2010-05-02
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

0
Comment
Question by:HobbitHouse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 7032485
don't use early binding... use late binding.

ie:

Dim wdApp as Word.Application

set wdApp = CreateObject("Word.Application")

then it won't matter won't version of word you have on your computer.
0
 

Author Comment

by:HobbitHouse
ID: 7032709
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.Application")
    wdApp.Documents.Add
    strWorkingDocName = wdApp.ActiveDocument.Name
    Set aThisDoc = wdApp.Documents(strWorkingDocName)
'
' the next line gives a compile error saying "method or data member not found"
'
    aThisDoc.PageSetup.Orientation = wdOrientLandscape
    Set range1 = aThisDoc.Range
    range1.Font.Name = "Courier New"
    range1.InsertAfter str
End Sub
0
 

Author Comment

by:HobbitHouse
ID: 7032715
str is a global document string
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Accepted Solution

by:
bobbit31 earned 100 total points
ID: 7032719
just to be sure, do:

Dim aThisDoc As Word.Document
Dim range1 As Word.Range
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7032721
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.Application")
   wdApp.Documents.Add
   strWorkingDocName = wdApp.ActiveDocument.Name
   Set aThisDoc = wdApp.Documents(strWorkingDocName)
'
' the next line gives a compile error saying "method or data member not found"
'
   aThisDoc.PageSetup.Orientation = wdOrientLandscape
   Set range1 = aThisDoc.Range
   range1.Font.Name = "Courier New"
   range1.InsertAfter str
End Sub

:O)Bruintje
0
 

Author Comment

by:HobbitHouse
ID: 7033039
that did the trick.  many thanks.

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7033048
glad you got it! :)
0
 

Author Comment

by:HobbitHouse
ID: 7033138
bruntjie, thanks for your time as well
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question