Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Format To Export For Mail Merge


I am developing an app that includes an address book. I wish to be able to integrate my app with Word or Word Perfect to allow the printing of form letters or labels, but I have not been able to find any information about the format required for either of those word processors for mail merge. I assume I need to create the data file but do not know what is required. Can anyone help me?Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Word Mail Merge Date Format
Dear All,

I'm doing word mail merge in VB using this method:

<
Dim retstr As String
.
.
WordServer.Selection.TypeText Text:="" & retstr
.
.
.
>

Previously, I format a date in VB to "DD/MM/YYYY" as retstr and insert into the word document. Now, I'd like to change the format to: "15th December, 2002" (where th is to be displayed in superscripts).

Unfortunately, I can't find any method to superscript the text. Any one can help?

How To Add Merge Fields In Merge Mail During Run-time?
This is about automating merge mail in a word file. The data source is an Excel file. What I want to do is to add the merge fields into the word file dynamically, which means through coding using VBA, not by editing the word file. Can someone tell me the solution? Your answer will be highly appreciated.

Jason

How To Track Mail Delivery Failure After Mail Merge In Vb
****************My First VBForum Thread *********************

Hi all,

I have a requirement of mailmerge along with the ability to resend the mail to those recipients to whom, the mail did not deliver in the first attempt. It may happen because of invalid email id or recipient's inbox is full.

I have got one solution of using vb mapi controls and reading any unread mails after mail merge and look for delivery status failure mails. If found, i will resend the mail to that recipient.

I was wondering if there is any alternate solution. Like say, some status(success or failure of mail sent) check during the mailmerge itself.

Hope i have putforth my doubt clearly.
Awaiting response.

Thanks!

Word Mail Merge Commandbar "Insert Merge Field" Control
I'm having a problem with adding the Merge Fields toolbar programmatically in Word when performing a Mail Merge. I can add the toolbar fine but when I try to add the "Insert Merge Fields" dropdown control to this toolbar the drop down is not populated with the mergefields from the header source. When I add the toolbar and the control manually it works fine. I've even recorded the macro for this action but my code still does not work (my code is identical to the macro). Could someone help me out or let me now if this is a bug in word?

Thanks in advance,

Tom

Failed To Export The Report, Error In MS Excel Export Format DLL
Hi,

I have a little problem with Crystal Reports (CR 8) :

I try to export one of my reports from a VB program. When I try to export it in "Comma Separated Values" format everything is ok (except this is not the format I need
). When I try to export it in excel format it works, on some PCs but not on others ?

VB code sample :

rpt.ExportOptions.FormatType = crEFTExcel80Tabular
rpt.ExportOptions.DestinationType = crEDTDiskFile
rpt.ExportOptions.UseReportDateFormat = True
rpt.ExportOptions.UseReportNumberFormat = True
rpt.ExportOptions.DiskFileName = txtExportDirectory.Text & ExportName
rpt.Export False

I tried all the excel formats (crEFTExcel50, crEFTExcel50Tabular, crEFTExcel70 ...) but on some PC's I always get the "Exporting Records" window for a second and then the error "Failed to export the report, Error in MS Excel Export Format DLL".

Can anyone help me out ?
Thanks !

Export MSHFlexgrid Data To Excel Spreadsheet(Merge Row)
Hi,
How can i export MSHFlexgrid data that i entered and display using
Code:

With MSHFlexGrid1

    .TextMatrix(2, 6) = Form7.Text12.Text
    .TextMatrix(2, 7) = Form7.Text12.Text
    .TextMatrix(2, 8) = Form7.Text12.Text
    .MergeCells = flexMergeRestrictRows
    .mergeRow(2) = True
    .CellAlignment = 0
End With



Actually when i try to implement the code as been posted here, all the merge rows will be copied to Excel according to how many the Merge is. All i want is it only display the Merge for row 0 to row 8 of the MSHFlexGrid but for row 10 onward the data will be copied directly to Excel. Could u plz help me?Anyone?

Mail Merge And VB6.0
Hi all,

I had a vb program which query from a database and populate the result into a data file (i.e c: empdataFile1.doc) for a word template. Depending on the input to the vb program, the word template will be reading data from data files stored in different locations in the server.

The following is my code:

-------------------------------------------------------------------
Set objdoc = wd.Documents.Open(tSourceFilePath & " emplate.doc")
objdoc.MailMerge.OpenDataSource (tDesFilePath & "dataFile2.doc")
objdoc.MailMerge.Execute
objdoc.Close 0
-------------------------------------------------------------------

However, when i tried to open the template file, it seems to be referring to the old data file. Is there any way i can change the data source before the file is opened?


All help is greatly appreciated. Many thanks in advance.

VBA Mail Merge Help
I have several records in my DB table that I would like to perform a mail merge on using Access VBA. I already know how to perform the mail merge on all the records at once but I need to know if it is possible to loop through each of the records in the table and perform a seperate mail merge on each one. I also would like to know how to limit the results of a mail merge using a VBA query. Can this be done? Any help would be appreciated.


Rollin

Mail Merge
Hi! I am trying VBA to generate reports from a main document using mail merge. What I want to know: can I use more than one data sources for doing mail merge? Because in the report there are many parts which will pull data frome different data tables. thanks.

Mail Merge
I have created a basic template in a word doc that has the titles "name", "street" , "state", "zip", in each field of the template set up for mailing labels.

I used the autotext feature to populate each label with these titles for the whole page.

However, I would like to replace these with information from a grid. How do I access each field(label?) and put unique info in each one without doing so by reading from a file or query?

Basically how do I put info into each field and move to the next mailing label?

VBA And Mail Merge
I have a document which i would like to automate. I created the macro by recording my steps for adding the opening and adding the data. The code actually had the file i opened within the code itself enclosed in quotes. The code runs well but i would like to change the file location to variable of sorts. Each day this template will run but will require a different data file. How can i ask for the user to enter a file location by a browse button. I would like for it to look for only txt files.

below is the code i have so far.

Sub MergeAddresses()


Dim fileName As String


fileName = "C:1.txt"

ActiveDocument.MailMerge.OpenDataSource Name:=fileName, _
ConfirmConversions:=False, ReadOnly:=False, _
LinkToSource:=True,
AddToRecentFiles:=False, _ passwordDocument:="",PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",_ Revert:=False, Format:=wdOpenFormatAuto, Connection:="", _ SQLStatement:="", SQLStatement1:=""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
End Sub

Any help would be greatly appreciated.

Thank you,
Frank

Mail Merge
Hi there,

I have a situation that I am not sure how to handle.

I have a mail merge letter, once the mail merge process a new "document1" is created.
I would like to be able to have only one "customized" toolbar appear on the final
document. This toolbar would have specific printing instructions. I would also like this document to be unable to close until the final document has been printed. I successfully coded the merge document to do this...however, not realizing that after the merge process takes place a new document gets created and the code is not in the new document.

Can anyone help me in resolving this issue? Any example and/or suggestions would be greatly appreciated.

Thank you in advance for any assistance. I hope this makes sense. If not, fire off your questions. Thanks again.

Lorraine

Vb And Mail Merge
Hello all,

I want to know how, or if it is possible to mail merge with word 2000 and vb6 using the data contained in an ADODB.RecordSet?

All examples I've seen create the whole document on the fly.

What I want to do is merge with an existing document (if I can't do it with the ADODB.recordset I'm open to other suggestions).

Can anyone help me out or point me in the direction of resources that can?

Thanks in advance

Chris

Mail Merge
I've got an Access 97 db that generates the data for a mail merge template in Word.

My form has a command button that will start Word, but the user must find and open the template, print the form letters, then re-open and print the envelopes.

I need the code to open the template from my form in Access, or better still to simply print the mail merge and envelopes for the form letters.

TIA

Mail Merge Using VB
I need to be able to run a mail merge from VB. My script at the moment reads from a database and then dispalys a record ofg my choice. I need to be able to press a button or something that will transfer all my data to a mail merge document. I have no idea how to do this?? Or if it can be done?? I either need to transfer it to say a word file or a PDF?? Has anyone ever done anything like this?

Thanks

Mail Merge
Does anyone know how to do a mail merge from VB to Word using a Mysql database?
I have tried but with no luck. I can do it using an access database, but cant get it to work with a mysql database?

Mail Merge
When doing a mail merge does anyone know the correct syntax to code the sql statement string. I want to do;

SELECT * FROM [questionnaire_title] WHERE [Survey_ID] = '1'

However it doesnt like the syntax. Can someone help??

Mail Merge
Hey Group.
Is it possible to do mailmerge in VB without referencing ms word ?

Mail Merge
Hi!

I'm trying to do Mail Merge with VB, SQL (Database) and Microsoft Word.
Using Word 2002 everything works fine.

When I try to use Word 2003 I have a sequence of 2 errors and a strange behavior in word..

The errors:
[9105] String is longer than 255 characters
[5852] Requested object is not available

After that, it opens the word document with the mail merge tool bar disabled!!

I really don't know what to do
I need this to work well, the costumers shouldn't worry about their word versions!

If someone has any idea I'd be very greatfull..

Thankx a lot

Edit by HardCode: Please post in standard font. It makes it easier to read your question and find you the answers

Mail Merge Help
I need to perfrom a mail merge from vb to word. I currently have a program made in vb which is connected to access and i need to be able to use the data from access to do the mail merge. I have considered two ideas. The first would be to import the text from a document into vb and to change the relevant text. The second idea is to search through the text in word itself and replace each word that way. I think the second one will be better though

The code for the mail merge is currently:

Dim objWord as object

Set objWord = CreateObject("Word.Application")
objWord.Visible = False
objWord.Documents.Open FileName:=("C: est.doc")

I have seen other people ask similar questions to this and all the answers dont seem to work for me. I get problems such as it saying i am trying to use a user-defined type. I am guessing they are using a different version, possibly vb.net?

I was hoping the user could write a letter with words such as <Name> in, then i could replace this with, for example, John Smith. How would i such for '<Name>' in the document?

Mail Merge
Hi

I have created an application that u can connect to any database via an ODBC login and execute an SQL string on that Database and the results of the query are displayed on a grid.

Now my main problem is that i want to create sort of a mail merge feature whereby u can specify a specific field (of the query you executed) in text box and you are able to preview the message.

Example: i execute this query.
select fname,balance from customers

i then enter the message below in a textbox

Hallo !fname, your current balance is !bal. please pay this amount to avoid disconnection. Customer Service.

when you click on preview you are able to see the message below


Hallo A Nother, your current balance is $30. please pay this amount to avoid disconnection. Customer Service.

i havent been able to do this. anyone who can help me out? regards

Mail Merge
i need to find and replace placeholders in a word document e.g

1.doc contains
{Cadd}

i need to find that and replace it with

57 hasdfh
southbas
asdkl askdj

and i need to do this via vb6

i found this example but it doesnt seem to work,


VB Code:
Public Function ReplaceWord(strFind As Variant, strReplace As Variant, strTemplate As String, strSaveAs As String) As String        On Error GoTo ErrHandler        Dim xWORD As Object    Set xWORD = CreateObject("Word.Application")    xWORD.Documents.Open strTemplate        Dim i As Integer      For i = 1 To UBound(strFind)                 With xWORD.Selection.Find            .ClearFormatting            .Text = strFind(i)            .Replacement.Text = strReplace(i)            .Forward = True            .Wrap = 1            .Format = False            .MatchCase = False            .MatchWholeWord = False            .MatchWildcards = True            .MatchSoundsLike = False            .MatchAllWordForms = False        End With        xWORD.Selection.Start = 1        xWORD.Selection.End = 1                'Execute replacefunction !        xWORD.Selection.Find.Execute , , , , , , , , , , 1    Next i          'If Not Dir(strSaveAs, vbNormal) = "" Then        xWORD.Documents(strSaveAs).Save        xWORD.Documents(strSaveAs).Close    'Else    '    xWORD.Documents(strTemplate).SaveAs (strSaveAs)    '    xWORD.Documents(strTemplate).Close    'End If        xWORD.Quit    Set xWORD = Nothing        Exit Function    ErrHandler:    ReplaceWord = "modDocumentwriter::ReplaceWord() " & Err.Description & " (" & Err.Number & ")"End Function


i am doing this for a college project so please do help

Mail Merge ?
Hello
i came across this statement
"comma delimitation is required for files that certain mail merge and spreadsheet programs read"

what is a mail merge program?

Mail Merge
Hi All

I want to include standard letters with my application and want to give the user the Flexibility to modify these letters. I want these letters to include some variable fields from the sql server database. I use VB 6 and Crystal Reports 8 for my reporting. I am however not sure how to go about and what tool will be most suitable to design this in. Can somebody please give me advise.

Mail Merge
How can I use MSWord Mail Merge option from VB? Thanks for help.

Mail Merge
I have an Access Db that i am wanting to do a Mail Merge on.

I am doing the merge on data stored in a Query.

I want to display the information with break in. For example, there may be 5 items in the query. Product A to F.

I want to display the data in a list. Product A, then a break, Product B, then a break, and so on.

Any ideas ?

Mail Merge Through VB
guys, I just did a project for a small pre-school and now Im supposed to add a feature wherein the user can get printed letters in the name of all students.Trying to do this using Mail Merge in MS Word.-This is what I did-

1.Create a Form Letter and hook it up with my Application's Access Database.
2.In my application, use ShellExecute to open that Form Letter in MS Word.
3. Now the user just has to click the Merge button in MS Word to get all the letters.

Problem:

When I hook up the Form letter to the Access .MDB, it uses the hardcoded path of the MDB. This creates a problem if Im trying to install on a seperate machine. What do I do ?


Possible Soln.??? : I thot of running a Batch file everytime the program ran. The Batch file would copy the .mdb from the Application's path to a hardcoded path on the user's drive from where the form letter would also be seeking its .mdb. Doesnt sound very good..so

Mail Merge
I want to do Mail Merge.

I have a database in access. I have a document in Word. I know it's possible. But In my application the database is already opened and active. In a window i select all the addresses I want and the document and I say Mail Merge it should create a document with this Merged Data. is it possible to give a recordset as the datasource for mail merge?

VBA Mail Merge
I have a VBA Application that runs in Excel that will automate Mail Merge in Word. The excel macro runs and opens Word and the Excel Datasource(different file) and merges the data and prints out a report. I have 67 fields in my datasource. I manually run this Mail Merge through Word and it works perfectly. However, when I run it through my application it doesn't recognize the last 4 fields. When Im printing it makes me replace the merge fields.

Does anyone know why this could be happening?

VB Mail Merge Help
I am new to vb database programing. i have some knowledge as i have just gone through a database vb6 programming book.
I was wondering how you can create a mail merge using a recordset that has been opened from a database. The application i would like to use is word.

Need Help In Mail Merge
Hello,

I'm using the VB automation to print the mailing labels using the MS word label standard.
Here is my question.

While printing the Label Using the Print dialog box when I click Ok button everything works fine. But suppose if I Press Cancel button I'm getting error at the execute statement, Its saying something like this "Microsoft Word - Command Failed -4198" in my vb form.
Any body know about this error?

How to cancel the print without any error or anything.

Looking forward for any suggestion

Thanks in advance

Regards
rechen

Mail Merge
I need to be able to run a mail merge from VB. My script at the moment reads from a database and then dispalys a record ofg my choice. I need to be able to press a button or something that will transfer all my data to a mail merge document. I have no idea how to do this?? Or if it can be done?? I either need to transfer it to say a word file or a PDF?? Has anyone ever done anything like this?

Thanks

Mail Merge
i have a video club project with which i want to send circular letters to the members. Members' Details are in an Access Database. May someone help me to:
Create a mail merge document from vb to ms word

Mail Merge?
Hi,

I'm using a non-microsoft software that uses VBA for customization. WhenI get address information from this software, I'd like to mail mergethese addresses to a letter in MS Word and print. I'd appreciate ifanyone could tell me how should I start working on it... is any ActiveXcontrol required? ... don't need the exact code, but the steps to followwill be good enough to start with.

Thanks a lot in advanced.

Tanu Hoque

Help : ADO And Mail Merge-Reg
Hey All,

I my application using VB, i need to automate the mailmerge(MS Word) using an ADO Recordset. Please let me know how i will be able do this.

By

K.SENTHIL BABU [ email@removed ]



-------

Mail Merge
I am using VB6, Word/Access 2000. When creating a mailmerge doc I get the error: "Requested object is not available 5852", when attempting to execute the following code: With X.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
Any suggestions?
Thanks in advance,
Tom

Mail Merge
I need to be able to run a mail merge from VB. My script at the moment reads from a database and then dispalys a record ofg my choice. I need to be able to press a button or something that will transfer all my data to a mail merge document. I have no idea how to do this?? Or if it can be done?? I either need to transfer it to say a word file or a PDF?? Has anyone ever done anything like this?

Thanks

Mail Merge
Ive got an access database and a rather large SQL query.
I want to have a command button that will open up the word document (that is predesigned) with all the merged data in it ready for printing.

The properties i thought it would be obvious to use (querystring, datasource, etc) are read only so how do i do it ?

Also if I wanted to open a word document to design a template for the mail merge how would i do it so the datafields to insert are already there so the user doesnt have to connect to the database manually.

thanks

Mail Merge Via Vb
Hi,
I am writing a code to send email automatically for the selected list of clients.

    Set wrd = CreateObject("Word.Application")

    wrd.Documents.Open (App.Path + "mailFile.Doc")
    With wrd.ActiveDocument.MailMerge
        .OpenDataSource App.Path + "mailfile.txt"
        .MailAddressFieldName = "emailid"
        .Destination = wdSendToEmail
        .MailAsAttachment = False
        .MailSubject = "Testing through VB via mail merge"
        .SuppressBlankLines = True
       .Execute
   End With

this code works fine and send individual mails for all the clients. the mails are now in my outlook express - inbox.
when I try to send them it produces an error message..

An unknown error has occurred. Subject 'Testing through VB via mail merge', Account: '169.254.0.8', Server: '169.254.0.8', Protocol: SMTP, Server Response: '554 Message does not conform to standards', Port: 25, Secure(SSL): No, Server Error: 554, Error Number: 0x800CCC6F

but when I open the mail from inbox and send again.. it works.

can anyone help me..

Mail Merge From VB
I want to implement the mail merge in VB. I have the DataSource.Doc file and the template file. I want to fill the fields in the datasource from a VB application and merge with the template. How can i do this?

Mail Merge
Hi all,
I am attempting to use an ADODB recordset created within the VB6.0 IDE at run time as the data source for a mail merge in an MS Word 9.0 template. It seems relatively straight forword to assign an external data source such as MS Access however I cannot find a means of assigning the data source as the ADODB recordset at run time. Does anybody know if this is possible. Any help would be apreciated.

priesto.

Mail Merge
Hi All,

I want to ask a query to all of you.

Please Help With Mail Merge
I am trying to create a mail merge document in access 2k and word2k using a query designed to accomodate the desired results for the form letter. The problem arises when I need to include all purchases placed with a customer...how do I create the form letter and it know how many purchases made for that customer and then move to the next customer???? Please can anyone offer some quidance??


Thanks in advance!!!

Donna

:mail Merge Bug..
hi after performing a mail merge in vb. a message box will appear.
Although the mail merge works perfectly fine.

Microsoft Word
This file is in use by another application or user.
(C:Documents and Settings...Normal.dot)

It seems like the opened document during a mail merge is not closed.
So if i performed mail merge 3 times, this will appear three times too.
Is there any way i can avoid this kind of bug..?





Edited by - milenyume on 10/10/2005 10:44:02 PM

Mail Merge
Hi,

I am using the mailmerge object from word library in VB. I am able to mailmerge my document. The address for mailmerge is coming from the database.I have a problem in this. The display of the address on the document is being preceded and followed by anchor tags i.e., "&lt;&lt;Address&gt;&gt;". In the process if the address consists of two strings, only one string is being put on the document. Please do provide any pointers if you happen to know....

Thanks,
Nidhi

Mail Merge From A Template
I have looked all over for a solution to this but i haven't found anything yet.

What i am wanting to do is mail merge a custom query (the selected fields always remain the same but the data does not) with a pre-created mail merge template.

I have had many problems so far and have not got anything to work satisfactory at all.

Firstly, in my word template, how do i create the would-be merge fields when i cannot select a data source at design time?

Is it possible to load a template from VB6 code and replace custom text that is acting as a merge field with an actual merge field from the query?

If anyone has any ideas they would be greatly appreciated.

Thanks

Mail Merge In Word
Edit by herilane: If you want to ask a question, please start a new thread, linking to the old one if necessary / relevant.
http://www.xtremevbtalk.com/showthread.php?t=177117

I'm having the same problem! Did you ever find a way to fix this?

Thanks, Joni

Word Mail Merge Using VB6
I am trying to make a word mail merge document. I have added a commandbar button to Word. When the button is clicked I want some code to execute:

With doc.MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:= _
"Name of .mdb file" _
, ConfirmConversions:=False, ReadOnly:=True, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenSource, Connection:="TABLE Table Name", _
SQLStatement:="SELECT * FROM [table Name]",
SQLStatement1:=""...

What can I do if the .mdb file that I am using has a Password allocated to it?
Any mail merge examples will be welcome.

Word Mail Merge
I have searched the forum, and have not found this specific question answered so I'm posting. When opening the datasource for a mailmerge in word, through macros, is it possible to prevent word from asking the user to confirm the datasource? The datasource is an excel spreadsheet, and after opening it, the macro waits until the user confirms the sheet they wish to use. Thanks for the help.

Copyright © 2005-08 www.BigResource.com, All rights reserved