get and past htmlsigniture from outlook into excel

selkov

Well-known Member
Joined
Jan 26, 2004
Messages
787
Is there some way to read the outlook signature html file and paste the signature to the end of an excel spreadsheet?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You can define multiple signatures in Outlook, and can have multiple accounts. If you go to

C:\Users\[username]<username>\AppData\Roaming\Microsoft\Signatures

you will see your signature files. Do you just see one HTM (not HTML) file? If so, you can code to that. Otherwise you need a way to select which account to use.

Rich (BB code):
Public Function GetSignature() As String


   Dim TextLine As String
   Open "C:\Users\[username]\AppData\Roaming\Microsoft\Signatures\[sigfilename].htm" For Input As #1 
   Do Until EOF(1)
      Line Input #1 , TextLine
      GetSignature = GetSignature & TextLine
   Loop
   Close #1 
   
End Function

It might also be possible to do this by creating an Outlook instance and retrieving the signature through that, but I thought this was a little easier.

Note! This returns HTML code. If you want to insert it into an Excel file and have it look the same way it does in an email, that's a completely different problem.</username>
 
Last edited:
Upvote 0
I do have a htm file available and I do want to insert it into an Excel file and have it look the same way it does in an email.
How can I do that?
 
Upvote 0
Open the signature file in Excel, copy it, paste it where you want it, and close. This will paste it into the active sheet after the last row column A that has data.

Depending on how complex your signature is, the format may not be compatible. For example, in my signature, Excel opens with a very wide column A, but if the sheet you are pasting into does not have a wide column A, it won't look right.

Rich (BB code):
Public Sub PasteSignature()

   Dim SigWB As Workbook
   
   Set SigWB = Workbooks.Open("C:\Users\[username]\AppData\Roaming\Microsoft\Signatures\[sig file name].htm")
   SigWB.Worksheets(1).UsedRange.Copy Cells(Cells(Rows.Count, 1).End(xlUp).Row + 1, "A")
   SigWB.Close savechanges:=False
   
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,467
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top