
Getting Error Code:5922 when running word mail merge on Office XP
Hello DShah,
See the following KB article, specifically where it has "Method 2: Turn Off
the Option to Hide File Extensions:"
Q224056 - WD2000: Error Message: Word Was Unable to Open the Data Source
http://support.microsoft.com/support/kb/articles/q224/0/56.asp
Does "turning off the option to hide file extensions" make the problem go
away? A different workaround you can try is to remove the ODBC text
driver. That way, only the native "Text Files(*.txt)" option is available
for Word mail merge.
Another way to perform a mail merge is shown in the following article,
where you put your source data into a Word document and use that document
as the source, instead of using the text file directly as the source:
Q220607 - HOWTO: Automate Word to do Mail Merge from Visual Basic
http://support.microsoft.com/support/kb/articles/q220/6/07.asp
For information and sample code for integrating Office with Visual Basic,
Visual C++, Internet Scripts, and other programming languages, please see
http://msdn.microsoft.com/library/techart/VSOfficeDev.htm. This site
contains the most up-to-date information for using developer tools for
Office integration and extensibility.
HTH,
Greg Ellison
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
--------------------
Quote:
>Subject: Getting Error Code:5922 when running word mail merge on Office XP
>Date: Mon, 16 Sep 2002 15:16:35 -0700
>Hi
>I am getting error Code = 5922 "Word was unable to open
>the datasource" when running mail merge using MS-Word on
>Office XP. I can run the same code on WIN2K and it's
>running fine.
>I am getting information from the SQL Server in my visual
>basic code.Here is code where I am getting error on
>OpenDataSource method.
>Thanks in advance for any help.
>DShah
>Public Function mergeThis()
>Dim endDate
>On Error GoTo errorhandler
>With ActiveDocument.MailMerge
>.MainDocumentType = wdFormLetters
>constr = "UID=florist;PWD=;DSN=FTDFlorist;DATABASE=Store"
> sqlStmt = "SELECT * from FTD.recpInfo"
>.OpenDataSource Name:="c:\WingsTemplate.txt",
>Connection:=constr, SQLStatement:=sqlStmt
> .Destination = wdSendToNewDocument
> .MailAsAttachment = False
> .MailAddressFieldName = ""
> .MailSubject = ""
> .SuppressBlankLines = True
> With .DataSource
> .FirstRecord = wdDefaultFirstRecord
> .LastRecord = wdDefaultLastRecord
> End With
> .Execute Pause:=True
> End With
> Exit Function
>errorhandler:
> ' Some error handling code
> frmFinish.Hide
> Unload frmFinish
> frmGetStartDate.Show
>End Function