Re: Selecting multiple files and send them via email??
anonymous_at_discussions.microsoft.com
Date: 05/25/04
- Next message: anonymous_at_discussions.microsoft.com: "Re: How to make a textbox visible, when an item of a listbox is highlighted?"
- Previous message: Michael Cheng [MSFT]: "Re: Why 2 Records after a PassThru + DLookup?"
- In reply to: Cheryl Fischer: "Re: Selecting multiple files and send them via email??"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 May 2004 20:33:56 -0700
Cheryl
thanks for the hint.
I appriciate very much.
regards
Norman
>-----Original Message-----
>Norman,
>
>Here is some VBA that will work if you are using Outlook
Automation to send
>your emails. It uses of the code found at:
>
>http://www.mvps.org/access/api/api0001.htm
>
>This code makes use of Windows API calls to allow file
selection and
>requires no additional OCX file or dialog control (we
don't recommend these,
>as they are prone to versioning and licensing
problems). Don't worry
>about the API calls; this code is essentially "plug 'n
play".
>
>So, first: create a new Module and name it
FileHandling. Then copy all of
>the code from that link into the module.
>
>Second: copy the following function into the same
module (put it at the
>bottom).
>
>Function GetAttachments(strIn As String) As String
>'Calls GetOpenFileName dialog and allows user to
>'select attachments for an email
>Dim strFilter As String
>
>strFilter = ahtAddFilterItem(strFilter, "Text Files
(*.txt)", "*.TXT")
>strFilter = ahtAddFilterItem(strFilter, "RTF Documents
(*.rtf)", "*.RTF")
>strFilter = ahtAddFilterItem(strFilter, "Excel Work***
Files (*.xls)",
>"*.XLS")
>strFilter = ahtAddFilterItem(strFilter, _
> "Access Database
(*.mdb;*.mda;*.mde;*.mdw) ", _
> "*.mdb; *.mda; *.mde; *.mdw")
>strFilter = ahtAddFilterItem(strFilter, "dBASE Files
(*.dbf)", "*.DBF")
>strFilter = ahtAddFilterItem(strFilter, "All Files
(*.*)", "*.*")
>
>GetAttachments = ahtCommonFileOpenSave(Filter:=strFilter,
_
> OpenFile:=True, _
> DialogTitle:=strIn, _
> Flags:=ahtOFN_HIDEREADONLY)
>End Function
>
>Last: in the Click event of a command button on your
form, insert the
>following code
>
>Dim oApp As Outlook.Application
>Dim objNewMail As Outlook.MailItem
>Dim objOutlookAttach As Outlook.Attachment
>Dim strAtt As String
>
>
>Set oApp = New Outlook.Application
>Set objNewMail = oApp.CreateItem(olMailItem)
>With objNewMail
> .To = "someperson@somedomainn.com"
> .Subject = "Test subject"
> .Body = "Your text message here."
>
> ' Select files
> Do
> strAtt = GetAttachments("Select a file - click
Cancel when done")
> If strAtt <> "" Then
> Set objOutlookAttach = .Attachments.Add
(strAtt)
> Else
> Exit Do
> End If
> Loop
> ' End selection of files to attach
> .Save
> .Send
>
>End With
>
>
>hth,
>--
>
>Cheryl Fischer, MVP Microsoft Access
>
>
>
>"Norman F" <anonymous@discussions.microsoft.com> wrote in
message
>news:1115801c44157$ad023620$a001280a@phx.gbl...
>> Hi there,
>>
>> I have a database form that mimics the layout of an
>> outlook form.
>> It works ok, when I send one email at the time.
>>
>> How can I select multiple files from this access (2K)
form
>> either useing the file dialog or else (store /attache
the
>> files)or(store the directory name,and file name in
array??)
>>
>> I don't know,
>> any imput is much appreciated.
>>
>> kind regards
>> Norman
>
>
>.
>
- Next message: anonymous_at_discussions.microsoft.com: "Re: How to make a textbox visible, when an item of a listbox is highlighted?"
- Previous message: Michael Cheng [MSFT]: "Re: Why 2 Records after a PassThru + DLookup?"
- In reply to: Cheryl Fischer: "Re: Selecting multiple files and send them via email??"
- Messages sorted by: [ date ] [ thread ]