J
JK
I want to create a command button in Outlook 03 that would automatically
insert an email signature. One way was to copy the signature, record a new
macro and then click paste. These instructions I found online don't work
becuase all the macro is doing is pasting whatever is in the clipboard. If
you copy something else or restart the PC the macro fails.
So I think the best way is to hardcode it using VBA. I have the following
example that I found online and it works except it does not account for
formatting. One of the owners of the business I work for wants the ability to
easily insert a signature. However, he would also like to be able to select
the font for the sig which may or may not be the same as the message body.
I need to be able to program the selected font, size, and bold/italic
directly into the code below. I've never done this - does anyone know where I
could find an example of this online or be able to tell me how to do it?
Oh, and you'll notice I commented out the last line in the following code
"MyRange.InsertAfter (MyText)" if I don't comment it out the text is printed
twice?
Thanks,
Jason
Sub InsertAfterMethod()
Dim MyText As String
Dim MyRange As Object
Set MyRange = ActiveDocument.Range
MyText = "Jason Kaloyanides" '& vbCrLf & "Job Title" & vbCrLf & "Address"
' Selection Example:
Selection.InsertAfter (MyText)
' Range Example:
' (Inserts text at the current position of the insertion point.)
MyRange.Collapse
' MyRange.InsertAfter (MyText)
End Sub
insert an email signature. One way was to copy the signature, record a new
macro and then click paste. These instructions I found online don't work
becuase all the macro is doing is pasting whatever is in the clipboard. If
you copy something else or restart the PC the macro fails.
So I think the best way is to hardcode it using VBA. I have the following
example that I found online and it works except it does not account for
formatting. One of the owners of the business I work for wants the ability to
easily insert a signature. However, he would also like to be able to select
the font for the sig which may or may not be the same as the message body.
I need to be able to program the selected font, size, and bold/italic
directly into the code below. I've never done this - does anyone know where I
could find an example of this online or be able to tell me how to do it?
Oh, and you'll notice I commented out the last line in the following code
"MyRange.InsertAfter (MyText)" if I don't comment it out the text is printed
twice?
Thanks,
Jason
Sub InsertAfterMethod()
Dim MyText As String
Dim MyRange As Object
Set MyRange = ActiveDocument.Range
MyText = "Jason Kaloyanides" '& vbCrLf & "Job Title" & vbCrLf & "Address"
' Selection Example:
Selection.InsertAfter (MyText)
' Range Example:
' (Inserts text at the current position of the insertion point.)
MyRange.Collapse
' MyRange.InsertAfter (MyText)
End Sub