How send an open report as SendObject?

SteveL

Registered User.
Local time
Today, 08:19
Joined
Dec 3, 2004
Messages
60
Here is my situation...

I have a report open on the user's window. Additionally there is a form still open underneath and to the side of the report. On that form is a button which when I click it I would like the report to be sent to an e-mail address which is entered into a field on that open form.

But I need to have a line of text entered into the subject line of the email message and also have a pretty long string of text entered into the message body of the email message.

I've tried this with a macro but evidently have too much copy in the text of the message. If I shorten it it works fine. But I really can't do that. It needs to be the entire length.

I suspect the answer to be VBA but I really don't know where to begin.

Can someone help me out with this?

--Steve
 
For a beginner I suggest converting your macro to VBA and modify it to suit your needs. That is the first step most folks take when they are ready to take the big step from macros to VBA. Good luck!
 
But my problem is I really don't know how to code it to make it work.
 
SteveL said:
I've tried this with a macro but evidently have too much copy in the text of the message. If I shorten it it works fine. But I really can't do that. It needs to be the entire length.

I suspect the answer to be VBA but I really don't know where to begin.
Based on your statement you should be able to convert the macro with the short message and adjust the VBA code to suit your text length. You will be able to spot the text string in VBA.

Post back with more specifics if you need help after you have converted your macro to VBA.

To convert your macro to VBA, copy the form that has the button to which you have assigned the macro to the OnClick event. On the tool bar click... Tools / Macro / Convert Forms Macros to Visual Basic \ and follow the wizard.
 
ghudson...

Thanks for the reply. I have copy and pasted the name of the form into the on click event and tried what you suggest. But I get the following error...

"There was a problem opening the macro 'macroname'. Do you want to continue?"

Thoughts?

--Steve
 
New Line - How?

I have been able to convert the macro to VBA code. But now I want to be able to make a "new line" happen at a specific point in the text message. But what is happening is this...

Dear, recipientsname, vbNewLine & Message here.

Its just sticking the "vbNewLine" in the message and not creating a carriage return. What am I doing wrong?

--Steve



Here is the code...

DoCmd.SetWarnings False
DoCmd.SendObject acReport, "rptChangeOrderToEmail", "SnapshotFormat(*.snp)", _
Forms!frmSelectCOToEmailOrPrint!txtMailTo, Forms!frmSelectCOToEmailOrPrint!txtCCTo, _
Forms!frmSelectCOToEmailOrPrint!txtbccAddress, _
"Need Your Approval For Change To Your Job With The JohnsonGroup", _
Eval("""Dear, "" & [Reports]![rptChangeOrderToEmail]![txtReqBy] & "", vbNewLine & Message here."""), False, ""
DoCmd.SetWarnings True
 
Your vbNewLine is in the middle of your text string so that will not work. Play with something like this until you get it to work the way you want.

"Need Your Approval For Change To Your Job With The JohnsonGroup", _
Eval("""Dear, "" & [Reports]![rptChangeOrderToEmail]![txtReqBy] & ""," & vbNewLine & " & Message here."""), False, ""
 
To ghudson...

THANK YOU! Its perfect. I really appreciate all your help.

--Steve
 
To ghudson, (or anyone),

The SendObject "thing" is working fine now. But a new issue has developed.

The attachment I'm sending with the mail message has to be able to be opened on a pc and on a Mac. Snapshot format of course works great if opened on a pc. Any cosmetic horizontal lines display just fine as well as any checkboxes. But a Mac doesn't seem to be able to deal with a Snapshot format report. So I tried both rtf and html formats. The Mac can open them just fine but the cosmetic horizontal lines and checkboxes do not display.

Can anyone offer help on this new issue?

--Steve
 

Users who are viewing this thread

Back
Top Bottom