Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / March 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KZeeh - 09 Mar 2005 14:29 GMT
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!
Peter Jamieson - 09 Mar 2005 17:58 GMT
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

>I have a mailmerge program (actually written in FoxPro) that stopped
>working
[quoted text clipped - 13 lines]
> *******************************************************
> This is all the code!  Any help would be appreciated.  Thank you!
KZeeh - 09 Mar 2005 20:25 GMT
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!

> Something along the following lines:
>
[quoted text clipped - 48 lines]
> > *******************************************************
> > This is all the code!  Any help would be appreciated.  Thank you!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.