Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Snapshots - printing multiple reports as one

Status
Not open for further replies.

ottograham

Technical User
Mar 30, 2001
109
US
What is the best way to print many snapshot reports? For instance, I have an application that may print up to 12 different forms/reports. I'd like to send these as email attachments.

Can I append each onto one long file?

Is there a FAQ which shows the VB code to send the output to Netscape and fill in the To: and Subject: fields?

Thank you
 
This MAY work
forst you have to save each report as some kind of file HTML or RTF or whatever.
Save them in a new folder with just those reports.
Also save their names as you go in a Temp table or array so you have them for later.
report1.rtf
report2.rtf
etc.

Then use this CODE to e-mail those files as attachemnts
========================
This will send To, CC and BC as well as Subject, Message, and Attachment
You need 6 text boxes or variables which match the following:
txtMainAddresses
txtCC
txtBCC
txtSubject
txtBody
txtAttachment 'separate them with semi colons
' "report1.rtf" & "; " & "report2.rtf"

Put this in your Module
------------------------------
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
------------------------------
put this in a command button
------------------------------
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stext As String
Dim sAddedtext As String
If Len(txtMainAddresses) Then
stext = txtMainAddresses
End If
If Len(txtCC) Then
sAddedtext = sAddedtext & "&CC=" & txtCC
End If
If Len(txtBCC) Then
sAddedtext = sAddedtext & "&BCC=" & txtBCC
End If
If Len(txtSubject) Then
sAddedtext = sAddedtext & "&Subject=" & txtSubject
End If
If Len(txtBody) Then
sAddedtext = sAddedtext & "&Body=" & txtBody
End If
If Len(txtAttachment) Then
sAddedtext = sAddedtext & "Attach=" & Chr$(34) & txtAttachment & Chr$(34)
End If

stext = "mailto:" & stext

If Len(sAddedtext) <> 0 Then
Mid$(sAddedtext, 1, 1) = &quot;?&quot;
End If

stext = stext & sAddedtext

' launch default e-mail program
If Len(stext) Then
Call ShellExecute(hwnd, &quot;open&quot;, stext, vbNullString, vbNullString, SW_SHOWNORMAL)
End If

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

------------------------------







DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Dear Doug:

I've done the first step. I'm stuck on adding the Function to my module (I copied your code to the clipboard, then went into the module for the form and pasted it and also tried to add it by Insert/Procedure/Function...). I got Syntax errors etc (I also tried adding an End Function line...

What am I doing wrong?

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top