Hi Ashley,
Try this, It's a bit longwinded but works (in VB5 anyway).
Make sure under references you include "Microsoft MAPI Controls 5.0"
CODE:
----------------------------------------------------------
Private Sub SendMessage()
Dim MAPISession1 As Object
Dim MAPIMessages1 As Object
Set MAPISession1 = CreateObject("MSMAPI.MAPISession")
Set MAPIMessages1 = CreateObject("MSMAPI.MAPIMessages")
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
With MAPIMessages1
.MsgIndex = -1
.RecipDisplayName = "[EMAIL PROTECTED]"
.MsgSubject = "This is the subject line"
.MsgNoteText = "This is text in the body of email message."
.SessionID = MAPISession1.SessionID
.AttachmentPosition = 0
.AttachmentPathName =
"C:\MyFolder\MyDirtyGreatBigLongFileName.jpg"
.AttachmentName = "MyNiceFilename.jpg"
.Send
End With
MAPISession1.SignOff
Set MAPISession1 = Nothing
Set MAPIMessages1 = Nothing
MsgBox "Message sent!", , "Send Message"
End Sub
----------------------------------------------------------
-----Original Message-----
From: Simmonds, Ashley (PTB) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 16 October 2002 12:54 PM
To: 'Mapinfo List (E-mail)'
Subject: MI-L send pictures via mail
heya,
my code allows someone to automatically export the current mapper
window to
a JPG file, and then that file is opened in mspaint.
does anyone know how i can then have that file sent in a mail message?
currently... ( the last line is what i'm having trouble with, it seems
i can
only send an Access object)
sub DoStuff
Dim WindowIDee As Long
Dim AnnoyLevel As Integer
Dim PicName As String
'this is for iteration through the pictures already in the
directory
to create a new number
AnnoyLevel = 1
Do While PicName = ""
If Dir(CurrentProject.Path & "\MapInfo\" & Uzer &
Right("0" &
AnnoyLevel, 2) & ".jpg") = "" Then
PicName = CurrentProject.Path & "\MapInfo\" & Uzer &
Right("0" & AnnoyLevel, 2) & ".jpg"
Else
AnnoyLevel = AnnoyLevel + 1
End If
Loop
'gets the mapper window
WindowIDee = MIobj.Eval("windowinfo(1,13)")
'saves the window as a JPG file
MIobj.Do "Save window " & WindowIDee & " as " & Chr$(34) &
PicName &
Chr$(34) & " Type " & Chr$(34) & "jpeg" & Chr$(34)
'opens PAINT with the newly created picture
call Shell("mspaint.EXE " & Chr$(34) & PicName & Chr$(34),
vbMaximizedFocus)
'makes a dialog message box to give time to edit picture
MsgBox "edit the picture as desired" & vbCrLf & vbCrLf & "ONLY
CLOSE
THIS MESSAGE WHEN YOU HAVE COMPLETED YOUR EDITING", vbCritical, "do
stuff to
stops"
'this is the bit where i want to send an email which
automatically
includes the picture file
DoCmd.SendObject , PicName, acFormatHTML, "Ashley simmonds", ,
,
"Bus Stop Alterations", , True
end sub
gramercy
ash
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 3599