Re: text file for mail merge



Show us the code of the macro that you have.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Curt" <Curt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FC1164E0-ED93-481E-99F9-1706CE2CCF9E@xxxxxxxxxxxxxxxx
got around most of the problems. created a recorded macro in word just
fine.
When I run it stops on delimiter screen. Is there code that will set the
delimiter selection for macros?
Thanks

"Doug Robbins - Word MVP" wrote:

I would open the text file in Word and then use a macro to replace the
three
commas by a carriage return (vbCr) and the replace the individual commas
by
tabs, though the last step is probably not necessary as with each record
in
a separate paragraphs as a result of the first replacement, the file
should
then be able to be used as a data source for mail merge.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Curt" <Curt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:38756D0A-CF4A-485E-BF04-2F186EBB0EEB@xxxxxxxxxxxxxxxx
Have text file for merge purpose. cells are seperated by a comma rows
are
seperated by there commas. Mail merge selection does not as I can see
reconize
3 comma seperation. Is there a way to set row seperation as I create
the
text file.
The following works fine to create the text file.
Thanks

Sub SaveData2()
Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If RowCount > 1 Then TotalFile = TotalFile & vbCrLf
For ColCount = 1 To Cells(RowCount,
Columns.Count).End(xlToLeft).Column
If ColCount > 1 Then TotalFile = TotalFile & ","
TotalFile = TotalFile & Cells(RowCount, ColCount).Value
Next
Next
Print #FF, TotalFile
Close #FF
End Sub





.



Relevant Pages

  • Re: text file for mail merge
    ... created a recorded macro in word just fine. ... commas by a carriage return and the replace the individual commas by ... Dim RowCount As Long ... TotalFile = TotalFile & Cells ...
    (microsoft.public.word.vba.beginners)
  • Re: text file for mail merge
    ... commas separating each record. ... My recommendation was to open that file in Word and use a macro (just ... Dim RowCount As Long ... TotalFile = TotalFile & Cells ...
    (microsoft.public.word.vba.beginners)
  • Re: text file for mail merge
    ... commas by a carriage return and the replace the individual commas by ... Is there a way to set row seperation as I create the ... Dim RowCount As Long ... TotalFile = TotalFile & Cells ...
    (microsoft.public.word.vba.beginners)
  • Re: Text file I/O in VBA
    ... A new dialog opens with the specifications you have just ... the commas are also handled well into your cleaned ... Dim f1 As Integer ... Dim fInput As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: Array Reference
    ... Public TotalFile As String ... Dim FileNum As Integer ... Dim TotalFile As String ...
    (microsoft.public.vb.general.discussion)

Loading