Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default setting delimiters

Have the following code that creates a small text file. I need to set the
delimiters to tab for field and enter for record. The reason is so it can be
reconized by word for mail merge.
Thanks

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
Dim MyFile As Variable
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If WorksheetFunction.CountBlank(range("a" & RowCount & ":e" &
RowCount)) = 0 Then
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
End If
Next

Dim Blanks As Long
Dim LastRow As Integer
Blanks = msgbox(Prompt:="Do you have blanks to complete?,If not sure
Click on Yes", Buttons:=vbYesNo)
If Blanks = vbYes Then
LastRow = Cells(Rows.Count, "A").End(xlUp).row
range("D5:M5").Resize(LastRow - 4).Select
Userform1_Main_form.Hide
Selection.specialcells(xlCellTypeBlanks).Select
End If
If Blanks = vbNo Then
End If
Print #FF, TotalFile
Close #FF
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default setting delimiters

A tab is chr(9). so make the following replacement

from
If ColCount 1 Then TotalFile = TotalFile & ","
to
If ColCount 1 Then TotalFile = TotalFile & chr(9)

"Curt" wrote:

Have the following code that creates a small text file. I need to set the
delimiters to tab for field and enter for record. The reason is so it can be
reconized by word for mail merge.
Thanks

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
Dim MyFile As Variable
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If WorksheetFunction.CountBlank(range("a" & RowCount & ":e" &
RowCount)) = 0 Then
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
End If
Next

Dim Blanks As Long
Dim LastRow As Integer
Blanks = msgbox(Prompt:="Do you have blanks to complete?,If not sure
Click on Yes", Buttons:=vbYesNo)
If Blanks = vbYes Then
LastRow = Cells(Rows.Count, "A").End(xlUp).row
range("D5:M5").Resize(LastRow - 4).Select
Userform1_Main_form.Hide
Selection.specialcells(xlCellTypeBlanks).Select
End If
If Blanks = vbNo Then
End If
Print #FF, TotalFile
Close #FF

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default setting delimiters

Thank You

"Joel" wrote:

A tab is chr(9). so make the following replacement

from
If ColCount 1 Then TotalFile = TotalFile & ","
to
If ColCount 1 Then TotalFile = TotalFile & chr(9)

"Curt" wrote:

Have the following code that creates a small text file. I need to set the
delimiters to tab for field and enter for record. The reason is so it can be
reconized by word for mail merge.
Thanks

Dim FF As Long
Dim RowCount As Long
Dim ColCount As Long
Dim TotalFile As String
Dim MyFile As Variable
FF = FreeFile
Open "C:\Parade\ZZZ.txt" For Output As #FF
For RowCount = 1 To Cells(Rows.Count, "A").End(xlUp).row
If WorksheetFunction.CountBlank(range("a" & RowCount & ":e" &
RowCount)) = 0 Then
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
End If
Next

Dim Blanks As Long
Dim LastRow As Integer
Blanks = msgbox(Prompt:="Do you have blanks to complete?,If not sure
Click on Yes", Buttons:=vbYesNo)
If Blanks = vbYes Then
LastRow = Cells(Rows.Count, "A").End(xlUp).row
range("D5:M5").Resize(LastRow - 4).Select
Userform1_Main_form.Hide
Selection.specialcells(xlCellTypeBlanks).Select
End If
If Blanks = vbNo Then
End If
Print #FF, TotalFile
Close #FF

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Delimiters Doug Mc New Users to Excel 9 October 18th 09 03:36 PM
Multiple Delimiters hassanq23 Excel Discussion (Misc queries) 5 April 7th 09 01:16 AM
delimiters and manipulation PBArich Excel Worksheet Functions 0 June 12th 07 06:46 PM
setting delimiters for pasted data Tom Harvey Excel Programming 2 November 19th 05 09:40 PM
Grabbing a String between two delimiters Kirk[_2_] Excel Programming 2 July 28th 03 08:38 PM


All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"