So instead of exporting to Excel like Ive seen before, I was wondering if anyone has ever exported a datagridview to Outlook in an email? Is this possible and if so does anyone have an VB code that could help put me on the right path for this?
Export to Email in Windows Application?
Collapse
X
-
Tags: None
-
OUtlook
THis is how i send a listbox items to outlook.
I'm sure its possible to alter and send a gridviews information.
[CODE=vb]Dim objOutlook, objMsg, objNameSpace, objFolder, strOutput, strSubject, StrTo, StrMsg
StrTo = Mail
Const olMailItem = 0
'objMsg.To = StrTo
objOutlook = CreateObject("O utlook.applicat ion")
objNameSpace = objOutlook.GetN ameSpace("MAPI" )
Dim strBuiler As New StringBuilder
Dim strFinal As String
Dim i As Integer
Dim m As String
For i = 0 To ListBox2.Items. Count - 1
m = ListBox2.Items( i)
strBuiler.Appen d(m)
strBuiler.Appen d(";")
Next
strFinal = strBuiler.ToStr ing
objMsg = objOutlook.Crea teItem(olMailIt em)
objMsg.bcc = strFinal
objMsg.Display( )
objFolder = Nothing
objNameSpace = Nothing
objOutlook = Nothing
objMsg = Nothing[/CODE]
Comment