• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1126
  • Last Modified:

Send EML file to printer

Hi Experts !

I really need to send a .EML file (Outlook Express email file) to the printer from VB...

This line works perfectly to open my EML files (and PDF files) on screen :
  ShellExecute mdiPrincipal.hWnd, "open", strMyFile, vbNullString, "C:\", 1

This line works perfectly to print PDF files, but does nothing (not even an error) with an EML file :
  ShellExecute mdiPrincipal.hWnd, "print", strMyFile, vbNullString, "C:\", 0

Can anyone help me please ?  Either tell me whats wrong with the code above or other suggestions to replace that function would also be fine, as long as I can print my EML files from VB !!

Thanks alot !
0
jmantha709
Asked:
jmantha709
  • 3
  • 3
  • 2
2 Solutions
 
junglerover77Commented:
In fact, the statement

ShellExecute mdiPrincipal.hWnd, "print", strMyFile, vbNullString, "C:\", 0

is same to right-click the file, then select "print" in the popup menu. So, if you can find a software which would add a action "Print" for eml files, it would work.
0
 
rockiroadsCommented:
shell entry point for .EML files is to msimn.exe

Now there is only Open available via explorer,
"C:\Program Files\Outlook Express\msimn.exe" /eml:%1

Now does Outlook Express not use the IE print engine to print?

I had a look but cannot find the parameter to print.
0
 
rockiroadsCommented:
Have u tried opening a EML file? I dont have one handy so I dont know, is it plain text?
If so, could u not rename/copy the eml file to a .txt or .rtf file
then print that? ShellExecute will pick up Notepad print for .txt (unless u got some other file registered)

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jmantha709Author Commented:
Thanks for the suggestions, I'll have a look at that tonight when I get home and I'll get back to you guys.
0
 
jmantha709Author Commented:
The file can almost be considered as plain text, but not quite...  especially if it contains pictures or other attachments.

I don't know where I could find more info on this ?  Any help pointing me in the right direction would be appreciated...

Or if someone has another idea, I don't mind going another way to accomplish this task...

Thanks
0
 
junglerover77Commented:
Well, if you would like to change your way, why not say it earlier? That's not so difficult.

Just put a webbrowser control and 2 command buttons on a form and try the following code:

Private Sub Command1_Click()
    Call WebBrowser1.Navigate("c:\abc.eml")
End Sub

Private Sub Command2_Click()
    Call WebBrowser1.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER)
End Sub

Regards,
Jungle
0
 
rockiroadsCommented:
Ah the post by jungler may work, since OE uses the IE print engine.
Good idea jungle !
0
 
jmantha709Author Commented:
BTW,

>Well, if you would like to change your way, why not say it earlier?

I thought I had in my original question :

>...or other suggestions to replace that function would also be fine, as long as I can print my EML files from VB !!


Guess I wasn't clear enough !  Anyway, thanks again for the help ;-)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now