Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening word 97

Status
Not open for further replies.

TomG1

Programmer
Apr 12, 2001
25
BE
Hi,

at home I've got Win ME and Word 2000, in a program that I have written in VB 6.0 I'm openening Word and filling a table. That works great.

But when i trie to work with the program on a computer with Windows 95 and Office 97 I get an error-message when I trie to go to Word (via a button on a form).

How can I solve this?? Maybe by installing dcom95?

thx
 
dcom95 shouldn't have anyhting to do with it.
What code are you using to open Word?

Josh
 
Hi Josh
I'm using the following code

Dim appWD As word.Application
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
If Len(App.Path) > 3 Then
appWD.Documents.Open App.Path & "\eindeMaand.dot"
Else
appWD.Documents.Open App.Path & "eindeMaand.dot"
End If
appWD.WindowState = wdWindowStateMaximize

and then I'm filling the fields in the table

Tom
 
I think that It goes wrong when I'm actually want to open a document, because I've tried again and he opens word and then the error message is shown
maybe this is a bit more help

Tom
 
You've included a reference Microsoft Word 9.0 Object Library(msword9.olb).
Machines that run Word97 use Microsoft Word 8.0 Object Library(msword8.olb). They don't have the file msword9.olb.

You may want to look into the ShellExecute API call to open Word or find out what the rules are on distributing msword9.olb to Word97 machines.

Good Luck!
Josh
 
thx Josh for ShellExecute!!

but there is one problem with that, when I use it the first time, he opens Word and the requested document and fills up the right information in the table, but if I close word and trie to do it again, wham an error-message the error comes up when he tries to fill up the fields in the table, because he opens the document and word.
(if I don't close Word then the error-message doens't appear, and everything works fine)

this is how i call the function where i open the document.
r = startdoc("c:\facturatie\eindeMaand.dot")

the function ‘startdoc’ is the following

Private Function startdoc(docname)

Dim Scr_hDC As Integer
Scr_hDC = GetDesktopWindow()

startdoc = ShellExecute(Scr_hDC, "open", docname, "", "c:\facturatie", 12)

End Function

now when i trie to open it for the second time, after closing word he gives an error when he is at this line
ActiveDocument.Fields(1).Result.Text = maand

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top