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 / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

build text file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Curt - 12 May 2008 21:33 GMT
Have the following that creates a text file. Problem it does use th entire
sheet that has data. Is it possible to have it only use those rows that are
complete. Here is what I've got.
Thanks to all

Dim FF As Long
 Dim RowCount As Long
 Dim ColCount As Long
 Dim TotalFile As String
' Dim TotalFile As TextStream
 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
Joel - 13 May 2008 07:07 GMT
See if this works

Dim FF As Long
 Dim RowCount As Long
 Dim ColCount As Long
 Dim TotalFile As String
' Dim TotalFile As TextStream
 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 & ":F" & 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
 Print #FF, TotalFile
 Close #FF

> Have the following that creates a text file. Problem it does use th entire
> sheet that has data. Is it possible to have it only use those rows that are
[quoted text clipped - 17 lines]
>   Print #FF, TotalFile
>   Close #FF
Curt - 13 May 2008 14:27 GMT
I dont know if it is my server or what. When I click on link to read all I
get is a blank page. Got in thru another option in my favorites. This has
happened on others also.
Thanks

> See if this works
>
[quoted text clipped - 43 lines]
> >   Print #FF, TotalFile
> >   Close #FF
Curt - 13 May 2008 15:20 GMT
Not sure if poss added your code lines leaves out row with missing data as it
should. Is it poss to have a msg box come up on missing row. If to much will
create a message about missing data to appear before merge is done. All I
will say if data missing record will not print. Either way will work.
Thanks for help

> See if this works
>
[quoted text clipped - 43 lines]
> >   Print #FF, TotalFile
> >   Close #FF
Joel - 13 May 2008 17:49 GMT
When you get a blank page simply SIGN OUT in the upper right corner of the
Main Webpage at Microsoft.  Microsoft added some security features a few
months ago that require you to logout occasionally.  I find the problem when
I'm login on more than one PC at a time.

> Not sure if poss added your code lines leaves out row with missing data as it
> should. Is it poss to have a msg box come up on missing row. If to much will
[quoted text clipped - 49 lines]
> > >   Print #FF, TotalFile
> > >   Close #FF
 
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.