Working around security 
Author Message
 Working around security

Hi All,
I'm new to the Outlook forum, do most of my work with excel. I started
searching here for the answer to a problem I'm having sending an e-mail from
excel. I see that I'm not alone, many people with the same problem! Since I
do not wish to compromise my Outlook security, I have a question about
working around this problem!!!
Is it possible to create a macro in Outlook(2002) that will either copy and
paste or take cells from a excel worksheet cells(A1 to H20) and place them
in the message body, or open an htm file and copy it's contents into the
message body?

Thanks in Advance
Craig



Thu, 14 Jul 2005 13:48:24 GMT  
 Working around security

Quote:

> Hi All,
> I'm new to the Outlook forum, do most of my work with excel. I started
> searching here for the answer to a problem I'm having sending an e-mail from
> excel. I see that I'm not alone, many people with the same problem! Since I
> do not wish to compromise my Outlook security, I have a question about
> working around this problem!!!
> Is it possible to create a macro in Outlook(2002) that will either copy and
> paste or take cells from a excel worksheet cells(A1 to H20) and place them
> in the message body, or open an htm file and copy it's contents into the
> message body?

> Thanks in Advance
> Craig

Yes..it is possible to read the content of a html file and paste this
into the body of a mail.  You can use the file scripting objects to do
this -

sub createhtmlmail()
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.html", 1)
   ReadAllTextFile =   f.ReadAll
   Set myOlApp = CreateObject("Outlook.Application")
   Set myNameSpace = myOlApp.GetNameSpace("MAPI")
   Set myItem = myOlApp.CreateItem(0)
   myItem.htmlbody = f.readall
   myitem.display
end sub

Hope this helps!
Regards
Natarajan



Fri, 15 Jul 2005 17:03:49 GMT  
 Working around security
Since Natarajan has shown you how to read an .html file, I'll tackle the
Excel issue:

Sub GetExcelCellRangeAndPasteIntoCurrentMessage()

    Dim objExcel As New Excel.Application, objBook As Excel.Workbook
    Dim objCurMsg As Outlook.MailItem, objCBC As Office.CommandBarControl

    Set objBook = objExcel.Workbooks.Open("C:\Documents and
Settings\elegault\Desktop\Book1.xls")
    objBook.Sheets(1).Range("A1:H20").Select
    objBook.Sheets(1).Range("A1:H20").Copy

    Set objCurMsg = Application.ActiveInspector.CurrentItem
    Set objCBC = Application.ActiveInspector.CommandBars.FindControl(, 22)
    Application.ActiveInspector.Activate
    SendKeys "{TAB}", True
    SendKeys "{TAB}", True
    SendKeys "{TAB}", True
    SendKeys "{TAB}", True
    objCBC.Execute 'OR YOU CAN USE SendKeys "^{V}"
    objExcel.DisplayAlerts = False 'DISABLES THE ANNOYING "RETAIN CLIPBOARD
DATA?" MESSAGE
    objBook.Close False
    objExcel.Quit
    Set objBook = Nothing
    Set objExcel = Nothing
End Sub

--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca


Quote:
> Hi All,
> I'm new to the Outlook forum, do most of my work with excel. I started
> searching here for the answer to a problem I'm having sending an e-mail
from
> excel. I see that I'm not alone, many people with the same problem! Since
I
> do not wish to compromise my Outlook security, I have a question about
> working around this problem!!!
> Is it possible to create a macro in Outlook(2002) that will either copy
and
> paste or take cells from a excel worksheet cells(A1 to H20) and place them
> in the message body, or open an htm file and copy it's contents into the
> message body?

> Thanks in Advance
> Craig



Sat, 16 Jul 2005 04:34:17 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Work Around doesn't work for RichTextBox

2. Getting around Outlook E-mail security update

3. Work Around for Update?

4. Opening .CSV file from VBA mis-converts SOME dates - how to work-around

5. Work Around for AutoMail Send

6. work around for rich text puzzle

7. WorkGroup Work-Around

8. Working around GetAddress?

9. Document Map View work around?

10. AD search error work-around?

11. Working around screen scar

12. Masked Edit Control Work-around help needed!

 

 
Powered by phpBB® Forum Software