×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

vb6 fax/email problem
4

vb6 fax/email problem

vb6 fax/email problem

(OP)
I was handed a VB6 application that faxes up to 100 customers a night. The previous programmer put text into a richtextbox then faxed it page by page using FaxManJr until it was completely sent. It works okay.

Problem now is that some of these customers want the same information emailed instead of faxed to them, but I need to keep the current ability to fax for those that don't. Seems easy enough.

Here is what I have tried using clsSendMail to email:
-Putting richtextbox text into message body and then emailing. PROBLEM: The page is no longer formatted and with the email header, it splits the pages in undesired places. Would work okay if page breaks could be added.
-Using cutePDF to save individual pages as PDFs and sending as attachments. PROBLEM: CutePDF prompts for file name when saving and there might be on any givin night up to 100 of these. Need more automation.

I have been doing reseqarch for a few day on this and I am stuck on where I should look next. This seems like it should be a fairly easy project, but I am banging my head against the wall right now.

Could someone lead me in the right direction or give me some links that I should look at?

Thanks
Steve


RE: vb6 fax/email problem

If you are using the same thing as me.
Are you setting AsHTML true?

From the help doc

Set this property to true if your message is formatted as HTML text and you want the receiving email client to interpret the email as HTML instead of plain text.  You must also make sure the message text includes valid HTML tags. For example, setting this property to true and setting the Message Property to “Hello There” will be interpreted as plain text. To send your message as HTML you must set this property to true and set the message property to valid HTML, something like:

<HTML><BODY><B>Hello There</B></BODY></HTML>

You can embed images, etc. by using the AsHTML Property and the Attachment Property together.  When AsHTML is True the Attachment Property is used to embed files called out in the HTML code. The message text is scanned for file names that match the file names set via the Attachment Property.

RE: vb6 fax/email problem

(OP)
The message is currently formatted as rtf so sending as html doesn't work

RE: vb6 fax/email problem

Google "convert rtf to html" lots of solutions

RE: vb6 fax/email problem

(OP)
That could work but it doesn't allow me to place a page break. Still have the same problem, it is now formatted but when a page is printed, the page splits in undersired places.

RE: vb6 fax/email problem

3
Well why can't you just send it as an RTF file attachment?

RE: vb6 fax/email problem

(OP)
Would possibly work except the files are 550k and 1 email might have 15-20 attachments.

RE: vb6 fax/email problem

Well, neither a PDF or HTML file are going to solve that one ...

RE: vb6 fax/email problem

Well why can't you just send it as an RTF file attachment?

RE: vb6 fax/email problem

Er ... now there is no way I understand how that happened ...

RE: vb6 fax/email problem

Why not just zip the rtf files all together and send the one zip? I personally would rather have that sent to me rather than an email with 20 attachments or 20 emails.
Or just email a link, or a link for each file, to them and let them pull-them-in-from/view-them-on a server/homepage themselves.

RE: vb6 fax/email problem

(OP)
I have not tried zipping, do you have any links to doing that in VB6. I cannot use links because I don't want to place these files on the web server.

RE: vb6 fax/email problem

Coo, all these 3rd party tools when you can get Windows to do it for you ...

RE: vb6 fax/email problem

Please share strongm.

Swi

RE: vb6 fax/email problem

Heh! That request came a lot faster evan than I expected. OK, here's an illustrative example:

CODE

Option Explicit

Private Sub Command1_Click()

    CreateEmptyZip "c:\testzip.zip"
    
    With CreateObject("Shell.Application")
        .NameSpace("c:\testzip.zip").CopyHere "c:\test.txt"
        ' .NameSpace("c:\testzip.zip").CopyHere .NameSpace(FolderName).items 'use this line if we want to zip all items in a folder into our zip file
    End With
    ' All done!
End Sub


Public Sub CreateEmptyZip(sPath)
    Dim strZIPHeader As String
    
    strZIPHeader = Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0) ' header required to convince Windows shell that this is really a zip file
    With CreateObject("Scripting.FileSystemObject")
        .CreateTextFile(sPath).Write strZIPHeader
    End With
    
End Sub

RE: vb6 fax/email problem

The less I have to rely on 3rd party tools the better.  Thanks for sharing.

Swi

RE: vb6 fax/email problem

Just a second here, strongm.  So, you're saying that when the FileSystemObject gets convinced that this is really a zip file, it will automatically apply a zipping  condensation algorithm when storing the file?

RE: vb6 fax/email problem

strongm,

One other question.  Is this only XP compliant code or will it work with prior versions of windows?

Swi

RE: vb6 fax/email problem

There's nothing in this code that would be XP specific, unless the header line differs from opsys to opsys.  If that were so, I'm sure strongm would have mentioned it.

RE: vb6 fax/email problem


I would still use a 3rd party zip executable to zip the files if emailing to 100+ customers.

RE: vb6 fax/email problem


>3rd party zip executable to zip
3rd party zip

RE: vb6 fax/email problem

>I would still use a 3rd party zip executable to zip the files if emailing to 100+ customers.

Why?

RE: vb6 fax/email problem

Quote (Sberthold):

I would still use a 3rd party zip executable to zip the files if emailing to 100+ customers
Why?

>XP specific

No, but it is Shell specific, so you need to be XP or later ... (which nowadays would mean XP, W2K3, Vista and, I believe, W2K also works - so you ony really miss out on the frankly obsolete 16-bit OSs and NT4)

>it will automatically apply a zipping  condensation algorithm when storing the file?

Exactly so. Try it, and see what happens ...

RE: vb6 fax/email problem

Got a slow day tomorrow...I'll do it then and post back results for those interested.

RE: vb6 fax/email problem

strongm, thanks again.  I would assume that with some modification this could be set up to unzip files as well or do you have an example of that as well?  :)

Swi

RE: vb6 fax/email problem

Just to clarify slightly Bob: it is the Windows shell that does the zip handling, not the FileSystemObject

RE: vb6 fax/email problem

Aha, that makes more sense to me.  Well, that's nifty.  I just tried it and of course it works.  Thanks for sharing.

I got a little bit curious, though.  I tried creating an empty zip file, reading the text file into a string, and then attempted to write to the zip file using the TextStream object's Write method.  I got a "bad file mode" error, which kind of makes sense if the write method can't apply a condensing algorithm.  Am I to conclude from this that the CopyHere method is smart enough to apply a condensing algorithm when it encounters the string header?

RE: vb6 fax/email problem

You might want to start investigating Shell Namespace Extensions ...

the one I'm leveraging here is the CompressedFolder extension, which lives in zipfldr.dll in System32, and has a CLSID of {E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}

Oh, and if you have a poke around HKEY_CLASSES_ROOT\.zip you should see where I got the header string from

RE: vb6 fax/email problem

Oh, very good.  Thanks strongm, I'll give all that a look.

RE: vb6 fax/email problem

This seems to be doing an unzip for me;

Private Sub CbUnZip_Click()

    With CreateObject("Shell.Application")
        .NameSpace(CurDir$ & "\Dest").CopyHere .NameSpace(CurDir$ & "\testzip.zip").items
    End With
    
End Sub

regards Hugh

RE: vb6 fax/email problem

Zip and UnZip using CopyHere as described above both working for me under XP but niether working under Win 2000.

regards Hugh

RE: vb6 fax/email problem

As I hinted, I wasn't certain that it worked under 2000 - but given that mainstream support for 2000 terminated over a year ago Ihave to say I'm not too surprised or too concerned ...

RE: vb6 fax/email problem

Hey strongm
Using the "Shell.Application" method, how can I surpress the "Confirm File Replace" dialog message that appears if a file already exist in a zip?  I do want to replace.

RE: vb6 fax/email problem

I'm bumping this. I am having the same problem as Creepers in that I want to overwrite every time. My program involves many, many overwrites, handling the file data in between each one.

Thanks in advance.

RE: vb6 fax/email problem

Further to my post on 23 Nov 06 8:42; It works under Vista too.

RE: vb6 fax/email problem

Oh thanks, I think I was looking for snippets of code when I scanned and missed that.

RE: vb6 fax/email problem

Thanks strongm.  This even works is MS Access 2003.  The only problem I am having with it is that the ".NameSpace" parameter will not take a variable.  I have to put quotes around a path and filename.  It does not work dynamically.

RE: vb6 fax/email problem

> The only problem I am having with it is that the ".NameSpace" parameter will not take a variable. I have to put quotes around a path and filename. It does not work dynamically.


downlaw, just append a blank string to the start of the parameter in MS Access like so:

With CreateObject("Shell.Application")
.NameSpace("" & zipFile).CopyHere normalFile
End With

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close