![]() ![]() Set appOutlook = CreateObject("Outlook.Application") Option ExplicitĬfgFromEmail = Sheets("Email").Range("O5").ValueĬfgNotice = Sheets("Email").Cells(rownum, 10) '10 = column JĬfgTemplate = Sheets("Email").Cells(rownum, 11) '11 = column K Hers is the complete working code which removes signature from the mail template. Set rng = ActiveSheet.Range("a1", ActiveSheet.Cells(lastRow, lastCol)) Set olMsg = olApp.CreateItemFromTemplate("\\myserver\my_template.oft") I'm startin to wonder if what I'm trying to accomplish is even possible. The oft has an image header and some (html/formatted) text in it. The "problem" is that it should open a new e-mail based on an existing template (.oft) and paste it where it reads "". It selects the range, copies it to a blank e-mail, pastes it there and deletes the users' signature. So, this is the VBA code that is currently running. If only one cell is selected and is empty, it will paste the first cell with data from ActiveSheet Set rng = Selection.SpecialCells(xlCellTypeVisible) Set wrdBkm = wrdDoc.Bookmarks("_MailAutoSig") Set olApp = CreateObject("Outlook.Application") The last Sub will place a selected range from Excel into the body of the template Option Explicit This will remove the signature from an email template It marks Sub DeleteSig(msg As Outlook.MailItem) in yellow and highlights objDoc As Word.Document in blue. It opens a new e-mail message with signature and gives a compile error. Set objBkm = objDoc.Bookmarks("_MailAutoSig") Set objMsg = objOL.CreateItem(olMailItem) Set objOL = CreateObject("Outlook.Application") The code from Microsoft: Sub TestDeleteSig() I tested the example from the Microsoft site 1:1 but could not get it to work. Set OutMail = OutApp.CreateItemFromTemplate("Ĭurrently there is no DeleteSig sub. ![]() Set OutApp = CreateObject("Outlook.Application") LastRow = ActiveSheet.Cells(500, lastCol).End(xlUp).RowĪctiveSheet.Range("a1", ActiveSheet.Cells(lastRow, lastCol)).Copy LastCol = ActiveSheet.Range("a1").End(xlToRight).Column - 2 This is all working but Outlook adds the user's signature and that is unwanted. The user adds a date in the e-mail and pastes the copied range into the template. I have an Excel file where when the user presses a button:Ī range is selected and copied to the clipboardĪn Outlook message is created based on a templateĮ-mail will be sent "on behalf of" instead of the user's name/account ![]()
0 Comments
Leave a Reply. |