Solved

Word Object Library question

Posted on 2002-05-24
8
214 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

728 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