Solved

Word Object Library question

Posted on 2002-05-24
8
212 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
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 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…

770 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