Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB6 Automation to different versions of Word

Posted on 2000-03-08
2
Medium Priority
?
196 Views
Last Modified: 2010-05-18
My VB6 application references the Word 8.0 object library and automates Word97 OK

The application also needs to run on computers which have Word 95 installed but currently it fails with an err 429.

How can I (is it possible?) to make an application reference which ever version of Word the user has installed? (Including Word 2000 which I do not have).
0
Comment
Question by:midexpro
[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
2 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2596780
Use Late binding instead of early binding!

To use late binding, you don't reference Word, you declare your Word object variable as Object (Dim objWord As Object) and use the CreateObject to instantiate Word (Set objWord = CreateObject("Word.Application"))

This way, you will use whatever version the PC have installed.
0
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 150 total points
ID: 2596846
If you are using the Project/References to refer to the word 8.0 library, I'm afraid that you're out of luck.  You'll have to use a different method to work with multiple versions of Word.

Something like this can be used:

Global wdBasic As Object

Set wdBasic = CreateObject("Word.Basic")
wdBasic.FileOpen TMPLTDIR & "WINWORD\" & N & ".DOC"

This references the generic Word Basic object for you, and opens a document.  It will use the latest version of Word that the user has.

Note that you may need to check for the version of Word that the user has:

If Val(wdBasic.AppInfo(2)) >= 8 Then
  'Winword version
   wdBasic.FileExit   'doesnt work w/
             Word 6 (pre Office 97 ver.)
End If

This will also allow you to inform the user if there are features they will be unable to use, due to version limitations.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses

604 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