email packaging

ideprize

Well-known member
Joined
Oct 19, 2011
Messages
97
Programming Experience
10+
Hi All
Have vb.net code that processes "text" input into a Excel spread sheet - producing worksheet/worksheets for email. I want to combine the worksheets into one file prior to the email function. I can do this with the PDF variant by way of a great 3rd part app "pdftk". I have done a lot of looking on the web but none of the "merge" options really apply. Each worksheet saved is a page in the invoice and some of these invoices can be 20 pages - thus the need to "package" prior to the email function. I should note the vb.net code does the email as well by way of the netmail class. Any insight would be greatly appreciated.

Respectfully,
Ideprize
 
If you're ending up with multiple files then you must be creating one workbook per worksheet instead of one workbook for all worksheets. I'm no Excel expert but if you show the code you're using now, I reckon I should be able to point out what needs to change.
 
Thanks for your reply. I am only using one workbook. The code processes a text file sent from another program. That text data has written into it "end of page" when that is the case. The vb.net code transitions by way of an if check to the following code.
If UCase(strInbuff) = "END OF PAGE" Then
     If bolNoPrt Then
         'email customer
          intPgCnt = intPgCnt + 1
          strStr2 = Trim(Str(intPgCnt))                                                                       'R9, start
          If Len(strStr2) < 2 Then
              strStr2 = "0" + strStr2	'becomes the next page discriminant
          End If
          strStr1 = "invce" + strOrdrNum + strStr2 + strFlFormat(intFF)
          If File.Exists(strWrkArea + strMusr + "" + strStr1) Then
              File.Delete(strWrkArea + strMusr + "" + strStr1)
          End If
          oWorkSheet.SaveAs(strWrkArea + strMusr + "" + strStr1, intFlFormat(intFF))

Each worksheet is save under a unique identifier due to the page count. If there are 5 pages then 5 worksheets have been saved to a particular disk area (strWrkArea+strMusr). Currently I am forcing all output to be saved as PDF which later in the code allows me to collect them all into one file. The collection process is based upon all worksheets starting with the "invce" prefix and are separated and ordered by the logic that creates a two digit page count (I know there will never be more that 50 pages in any invoice) which becomes part of the saved worksheet name on the disk. What I am hoping for is a third part app like "pdftk" which allows me to specify the prefix "invce*" in wild card fashion to be exported to a single excel workbook/speadsheet. Under my current system I have to email all the worksheets as independent attachments. If it is the case each worksheet saved is a workbook than I must admit I did not realize that. I am not an Excel "jockey" either. if there is a method that can successively "append" the worksheets as the "pages" are generated than that is a solution as well. Again thanks for your help.
Respectfully,
Ideprize
 
Back
Top