I have an 'application' that is used to take supplied information from the user, query our SQL server, mate up some information and ultimately generate a CSV file that is then picked up by our label software and the end result is basically printing labels from excel. At least that is what the end user thinks.
After creating a new application to do the same thing but in a different department the code seams to have stopped working and I cannot figure out why.
What Happens is everything gets jammed into one line and it never indexes to the next row. Does anyone have any thoughts?
Below is the code. Thanks in advance.
After creating a new application to do the same thing but in a different department the code seams to have stopped working and I cannot figure out why.
What Happens is everything gets jammed into one line and it never indexes to the next row. Does anyone have any thoughts?
Below is the code. Thanks in advance.
Rich (BB code):
Private Sub q96print_Click()
'writes data to text file on local C:\ to generate label from Bartender Commander
Dim TextFile As Integer
Dim FilePath As String
Dim column_num As Integer
Dim record_num As Integer
Dim record_count As Integer
Dim package_qty As Integer
Dim Package_Sum As Integer
Package_Sum = Range("k72").Value
record_count = Range("x7").Value
package_count = Range("ag11").Value
lRow = 11
'write data to text file
FilePath = "C:\Bartender Commander Folder\q96export.csv"
TextFile = FreeFile
Open FilePath For Output As TextFile
Write #TextFile , "SO#", "PO#", "Customer", "# of packages", "po line", "ship date", "qty", "item", "description", "box info"
For record_num = 1 To record_count
For package_qty = 1 To package_count
For column_num = 1 To 9
Write #TextFile , Range("ad11:al60").Cells(record_num, column_num).Value,
If column_num = 9 Then
Write #TextFile , package_qty & " of " & package_count,
End If
Next column_num
Next package_qty
package_count = Range("A" & (lRow + 1)).Value
lRow = lRow + 1
Next record_num
Close TextFile
package_count = Range("Ag11").Value
lRow = 11
'''calls for the clear macro
'call q96clear_Click()
End Sub