Code Button to Copy Standard Text in Memo (message) Field

D

Delnang

I am looking for the code I could use behind a macro button that would
basically copy a sentence or two into the message (memo) field.

What I am hoping for is that I send a form to an employee... if they agree
with the content, they can click a button which would then paste a standard
statement "I agree to the above terms and conditions" to the mail message.

Thank you in advance,
Angie
 
S

Sue Mosher [MVP]

Are you able to publish forms to the Organizational Forms library on your
company's Exchange server? If not, then this project is not feasible. If so,
then please provide information about the Outlook version and whether these
would be plain text, HTML, or RTF format messages?
 
D

Delnang

Sue,
Thank you for your response. Yes, I am able to publish these forms to the
Organizational Forms library on our company's Exchange server. We are using
Outlook 2003. The message format type would be determined by the users
default which means it could be any of these three.

Thanks,
Angie
 
D

Delnang

The email editor choice is set by the user. The text copied in can be flat
rtf text...no bells and whistles.
Thank you,
Angie
 
S

Sue Mosher [MVP]

With all those details, we can now talk about a solution. If you want to
append text to the end, just concatenate the new text with the existing Body
property:

Item.Body = Item.Body & vbCrLf & "new stuff"

If you want the text inserted somewhere in the middle, I would put a
placeholder token there, something like %sig% or another string that won't
be mistaken for text. You can then use the Replace() function to replace
that text in the Body or HTMLBody property, as appropriate.
 
D

Delnang

I need just a little more help with the code. Will this be written like:

Function (Acknowledgement)
Item.Body = Item.Body & vbCrLf & "new stuff"
End Function

I do not know all the code to make it work. I added this code to a button
and it gives an error in line 1.

Thanks for hanging in with me.

Angie
 
S

Sue Mosher [MVP]

Parentheses are used to enclose arguments. Therefore, your function has no
name. And in fact, you don't want a function at all, because you're not
returning a value. See http://www.outlookcode.com/article.aspx?ID=38 for an
example of the Click event handler for a button on a form, which is what
you're creating, right?

Note that this is not a VBA macro, but VBScript code behind the form.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
D

Delnang

Great, thank you for all your help.

Angie

Sue Mosher said:
Parentheses are used to enclose arguments. Therefore, your function has no
name. And in fact, you don't want a function at all, because you're not
returning a value. See http://www.outlookcode.com/article.aspx?ID=38 for an
example of the Click event handler for a button on a form, which is what
you're creating, right?

Note that this is not a VBA macro, but VBScript code behind the form.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
D

Delnang

The code buttons are working fine where the buttons enter text in the memo
field. However...When the user Forwards a message which has an attachment
and the next user receives it and clicks Forward...the attachment field does
not display. The attachment is still there, but it doesn't display. Is
there a way to display the attachment field?
Angie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top