Can someone translate from word.basic to word.application for me??

K

KZeeh

I have a mailmerge program (actually written in FoxPro) that stopped working
in Office 2003. I think I need to rewrite b/c it uses word.basic. Is there
anyone that can translate my code into the word.application object? I think
this is what I need to use?
******************************************************
oWord = CREATEOBJECT("word.basic")
oWord.AppMinimize(1)
oWord.FileOpen("decision.doc")
oWord.MailMergetoDoc
oWord.WindowList(1)
oWord.AppMaximize('Microsoft Word')
oWord.FileClose(2)
*******************************************************
This is all the code! Any help would be appreciated. Thank you!
 
P

Peter Jamieson

Something along the following lines:

Dim oWord As Word.Application
Dim oDoc As Word.Document

Set oWord = CreateObject("Word.Application")
With oWord
.WindowState = wdWindowStateMinimize
Set oDoc = .Documents.Open("decision.doc")
With oDoc.MailMerge
.Destination = wdSendToNewDocument
.Execute ' Pause:=something
End With
' The Active Document is now the newly created document
' If you want that, you may not need any code, or maybe:
.ActiveWindow = ActiveDocument.ActiveWindow
' and to close the mail merge main document, try
oDoc.Close savechanges:=wdDoNotSaveChanges
' if you want the mail merge main document,. try
'.ActiveWindow = oDoc.ActiveWindow
.WindowState = wdWindowStateMaximize
Set oDoc = Nothing
End With
Set oWord = Nothing

However, it may not be the fact that it is Word basic that is preventing it
from working. At least one other possibility is that documents with mail
merge dta sources attached will not open correctly when you try to open them
programmatically because of a new security "feature" which requires you to
set up a new registry entry - see

http://support.microsoft.com/default.aspx?scid=kb;en-us;825765

Peter Jamieson
 
K

KZeeh

OK, I tried the registry thing and it did not change my error. I am going to
fool with the word.application object and see what I can come up with.
Thanks so much for the help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top