Sending Email from Access 2007 through Outlook 2007 using template

  • Thread starter Simon Hughes (ICSNET UK)
  • Start date
Status
Not open for further replies.
S

Simon Hughes (ICSNET UK)

I run a small home run I.T. Support company any have developed an Access 2007

database for all our business activities. I currently send email using a VBA

script although it does not allow me to be as flexible as I would like.

I often send emails to customers where I would like to have a good looking

email, as I have created an outlook template (oft) with our logo and the

formatting just as I want it.

An example of our requirement is to be able to add a time and date value

from an access form into one of these templates, along with initially opening

the template, then adding the email address again from a record value in the

access form.

My idea was to do it in a similar way to how we achieve sending data to a

Word 2007 template - by using bookmarks. This would allow us to preformat the

standard emails in a oft template file and then simply drop the required data

from the Access form into it at the bookmark locations.

Do you know where I can go with this, as I've spent hours crawling the

forums and have hit a wall!!

Look forward to your reply.
 
An Outlook .oft file doesn't have bookmarks. You have two choices here:

1) Use a Word document as the starting point, and use the code technique

shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to generate the

email messages.

-or-

2) Use placeholder text in your .oft file to mark the locations where you

want to replace that placeholder text with, for example, the date and time.

#2 is easier. Just call the Replace() function on the item's HTMLBody

property as needed.

Sue Mosher

"Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET

UK)> wrote in message

news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> I run a small home run I.T. Support company any have developed an Access
> 2007
> database for all our business activities. I currently send email using a
> VBA
> script although it does not allow me to be as flexible as I would like.

> I often send emails to customers where I would like to have a good looking
> email, as I have created an outlook template (oft) with our logo and the
> formatting just as I want it.

> An example of our requirement is to be able to add a time and date value
> from an access form into one of these templates, along with initially
> opening
> the template, then adding the email address again from a record value in
> the
> access form.

> My idea was to do it in a similar way to how we achieve sending data to a
> Word 2007 template - by using bookmarks. This would allow us to preformat
> the
> standard emails in a oft template file and then simply drop the required
> data
> from the Access form into it at the bookmark locations.
> Do you know where I can go with this, as I've spent hours crawling the
> forums and have hit a wall!!

> Look forward to your reply.
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Hi Sue,

Thanks for your reply, very helpful.

However, I am quite new to VBA and I am a little unsure of how to code the

Replace() function and how to call the oft templete to open and inset the

email address.

I ok with calling a new email message and sending the to,cc,bbc, subject and

body and even HTMLBody although not sure of the replace function.

Could you help at all, maybe you have an example that you have worked with

previously to point me in the right direction?

Thanks in advance.

Simon

"Sue Mosher [MVP]" wrote:


> An Outlook .oft file doesn't have bookmarks. You have two choices here:

> 1) Use a Word document as the starting point, and use the code technique
> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to generate the
> email messages.

> -or-

> 2) Use placeholder text in your .oft file to mark the locations where you
> want to replace that placeholder text with, for example, the date and time.

> #2 is easier. Just call the Replace() function on the item's HTMLBody
> property as needed.

> > Sue Mosher
> > >

> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> UK)> wrote in message
> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> >I run a small home run I.T. Support company any have developed an Access
> >2007
> > database for all our business activities. I currently send email using a
> > VBA
> > script although it does not allow me to be as flexible as I would like.
> > I often send emails to customers where I would like to have a good looking
> > email, as I have created an outlook template (oft) with our logo and the
> > formatting just as I want it.
> > An example of our requirement is to be able to add a time and date value
> > from an access form into one of these templates, along with initially
> > opening
> > the template, then adding the email address again from a record value in
> > the
> > access form.
> > My idea was to do it in a similar way to how we achieve sending data to a
> > Word 2007 template - by using bookmarks. This would allow us to preformat
> > the
> > standard emails in a oft template file and then simply drop the required
> > data
> > from the Access form into it at the bookmark locations.
> > Do you know where I can go with this, as I've spent hours crawling the
> > forums and have hit a wall!!
> > Look forward to your reply.


> .
>
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

To create a new message from an .oft file, use the Outlook object model's

Application.CreateItemFromTemplate() method, passing the path to the .oft

file as the argument.

Replace() works the same no matter what text you use it on:

updatedText = Replace(originalText, findText, replaceText)

If you have problems making that work with your variables, post your

existing code.

There's a detailed example in my book, which is available on Google Books.

Sue Mosher

"Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
wrote in message news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> Hi Sue,

> Thanks for your reply, very helpful.

> However, I am quite new to VBA and I am a little unsure of how to code the
> Replace() function and how to call the oft templete to open and inset the
> email address.

> I ok with calling a new email message and sending the to,cc,bbc, subject
> and
> body and even HTMLBody although not sure of the replace function.

> "Sue Mosher [MVP]" wrote:
>
> > An Outlook .oft file doesn't have bookmarks. You have two choices here:
>

>> 1) Use a Word document as the starting point, and use the code technique
> > shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to generate
> > the
> > email messages.
>

>> -or-
>

>> 2) Use placeholder text in your .oft file to mark the locations where you
> > want to replace that placeholder text with, for example, the date and
> > time.
>

>> #2 is easier. Just call the Replace() function on the item's HTMLBody
> > property as needed.
>

>> > > Sue Mosher
> > >> >> >
>
>> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> > UK)> wrote in message
> > news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> > >I run a small home run I.T. Support company any have developed an Access
> > >2007
> > > database for all our business activities. I currently send email using
> > > a
> > > VBA
> > > script although it does not allow me to be as flexible as I would like.
> >> > I often send emails to customers where I would like to have a good
> > > looking
> > > email, as I have created an outlook template (oft) with our logo and
> > > the
> > > formatting just as I want it.
> >> > An example of our requirement is to be able to add a time and date
> > > value
> > > from an access form into one of these templates, along with initially
> > > opening
> > > the template, then adding the email address again from a record value
> > > in
> > > the
> > > access form.
> >> > My idea was to do it in a similar way to how we achieve sending data to
> > > a
> > > Word 2007 template - by using bookmarks. This would allow us to
> > > preformat
> > > the
> > > standard emails in a oft template file and then simply drop the
> > > required
> > > data
> > > from the Access form into it at the bookmark locations.
> > > Do you know where I can go with this, as I've spent hours crawling the
> > > forums and have hit a wall!!
> >> > Look forward to your reply.

>

>
>> .
> >
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Hi Sue,

I appreciate your reply. I have just bought your book from Amazon am I am

expecting deliver on Thursday. Hopefully I can learn a thing or two from it !!

Which part of the book contains the sample code relating to my query?

Simon

"Sue Mosher [MVP]" wrote:


> To create a new message from an .oft file, use the Outlook object model's
> Application.CreateItemFromTemplate() method, passing the path to the .oft
> file as the argument.

> Replace() works the same no matter what text you use it on:

> updatedText = Replace(originalText, findText, replaceText)

> If you have problems making that work with your variables, post your
> existing code.

> There's a detailed example in my book, which is available on Google Books.
> > Sue Mosher
> > >

> "Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
> wrote in message news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> > Hi Sue,
> > Thanks for your reply, very helpful.
> > However, I am quite new to VBA and I am a little unsure of how to code the
> > Replace() function and how to call the oft templete to open and inset the
> > email address.
> > I ok with calling a new email message and sending the to,cc,bbc, subject
> > and
> > body and even HTMLBody although not sure of the replace function.
> > "Sue Mosher [MVP]" wrote:
> >
> >> An Outlook .oft file doesn't have bookmarks. You have two choices here:
> >
> >> 1) Use a Word document as the starting point, and use the code technique
> >> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to generate
> >> the
> >> email messages.
> >
> >> -or-
> >
> >> 2) Use placeholder text in your .oft file to mark the locations where you
> >> want to replace that placeholder text with, for example, the date and
> >> time.
> >
> >> #2 is easier. Just call the Replace() function on the item's HTMLBody
> >> property as needed.
> >
> >> > >> Sue Mosher
> >> > >> > >> > >
> >
> >> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> >> UK)> wrote in message
> >> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> >> >I run a small home run I.T. Support company any have developed an Access
> >> >2007
> >> > database for all our business activities. I currently send email using
> >> > a
> >> > VBA
> >> > script although it does not allow me to be as flexible as I would like.
> >> >> > I often send emails to customers where I would like to have a good
> >> > looking
> >> > email, as I have created an outlook template (oft) with our logo and
> >> > the
> >> > formatting just as I want it.
> >> >> > An example of our requirement is to be able to add a time and date
> >> > value
> >> > from an access form into one of these templates, along with initially
> >> > opening
> >> > the template, then adding the email address again from a record value
> >> > in
> >> > the
> >> > access form.
> >> >> > My idea was to do it in a similar way to how we achieve sending data to
> >> > a
> >> > Word 2007 template - by using bookmarks. This would allow us to
> >> > preformat
> >> > the
> >> > standard emails in a oft template file and then simply drop the
> >> > required
> >> > data
> >> > from the Access form into it at the bookmark locations.
> >> > Do you know where I can go with this, as I've spent hours crawling the
> >> > forums and have hit a wall!!
> >> >> > Look forward to your reply.
> >
> >
> >> .
> >>


> .
>
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

17.4.2 - Creating a message from a boilerplate template

Sue Mosher

"Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
wrote in message news:041E5D36-A86F-459D-8938-E5EAFFD592EB@microsoft.com...
> Hi Sue,

> I appreciate your reply. I have just bought your book from Amazon am I am
> expecting deliver on Thursday. Hopefully I can learn a thing or two from
> it !!

> Which part of the book contains the sample code relating to my query?

> Simon

> "Sue Mosher [MVP]" wrote:
>
> > To create a new message from an .oft file, use the Outlook object model's
> > Application.CreateItemFromTemplate() method, passing the path to the .oft
> > file as the argument.
>

>> Replace() works the same no matter what text you use it on:
>

>> updatedText = Replace(originalText, findText, replaceText)
>

>> If you have problems making that work with your variables, post your
> > existing code.
>

>> There's a detailed example in my book, which is available on Google
> > Books.
>

>> "Simon Hughes (ICSNET UK)"
> > <SimonHughesICSNETUK
>> wrote in message
> > news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> > > Hi Sue,
> >> > Thanks for your reply, very helpful.
> >> > However, I am quite new to VBA and I am a little unsure of how to code
> > > the
> > > Replace() function and how to call the oft templete to open and inset
> > > the
> > > email address.
> >> > I ok with calling a new email message and sending the to,cc,bbc,
> > > subject
> > > and
> > > body and even HTMLBody although not sure of the replace function.
> >> > "Sue Mosher [MVP]" wrote:
> >> >> An Outlook .oft file doesn't have bookmarks. You have two choices
> > >> here:
> > >
>> >> 1) Use a Word document as the starting point, and use the code
> > >> technique
> > >> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to
> > >> generate
> > >> the
> > >> email messages.
> > >
>> >> -or-
> > >
>> >> 2) Use placeholder text in your .oft file to mark the locations where
> > >> you
> > >> want to replace that placeholder text with, for example, the date and
> > >> time.
> > >
>> >> #2 is easier. Just call the Replace() function on the item's HTMLBody
> > >> property as needed.
> > >
>> >> > > >> Sue Mosher
> > >> >> >> >> >> >> >
>> >
>> >> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> > >> UK)> wrote in message
> > >> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> > >> >I run a small home run I.T. Support company any have developed an
> > >> >Access
> > >> >2007
> > >> > database for all our business activities. I currently send email
> > >> > using
> > >> > a
> > >> > VBA
> > >> > script although it does not allow me to be as flexible as I would
> > >> > like.
> > >>> >> > I often send emails to customers where I would like to have a good
> > >> > looking
> > >> > email, as I have created an outlook template (oft) with our logo and
> > >> > the
> > >> > formatting just as I want it.
> > >>> >> > An example of our requirement is to be able to add a time and date
> > >> > value
> > >> > from an access form into one of these templates, along with
> > >> > initially
> > >> > opening
> > >> > the template, then adding the email address again from a record
> > >> > value
> > >> > in
> > >> > the
> > >> > access form.
> > >>> >> > My idea was to do it in a similar way to how we achieve sending data
> > >> > to
> > >> > a
> > >> > Word 2007 template - by using bookmarks. This would allow us to
> > >> > preformat
> > >> > the
> > >> > standard emails in a oft template file and then simply drop the
> > >> > required
> > >> > data
> > >> > from the Access form into it at the bookmark locations.
> > >> > Do you know where I can go with this, as I've spent hours crawling
> > >> > the
> > >> > forums and have hit a wall!!
> > >>> >> > Look forward to your reply.
> > >
>> >
>> >> .
> > >>

>

>
>> .
> >
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Hi Sue,

I have been reading through your book although I seem unable to grasp the

idea of writing the VBA for opening a oft file and utilising the replace

function.

I want to be able to send an email address to the email once the vba has

opened it, then replace some data with data from a MS Access form which is

where the vba is going to be initiated from.

Could you help at all?

Simon

"Sue Mosher [MVP]" wrote:


> 17.4.2 - Creating a message from a boilerplate template

> > Sue Mosher
> > >

> "Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
> wrote in message news:041E5D36-A86F-459D-8938-E5EAFFD592EB@microsoft.com...
> > Hi Sue,
> > I appreciate your reply. I have just bought your book from Amazon am I am
> > expecting deliver on Thursday. Hopefully I can learn a thing or two from
> > it !!
> > Which part of the book contains the sample code relating to my query?
> > Simon
> > "Sue Mosher [MVP]" wrote:
> >
> >> To create a new message from an .oft file, use the Outlook object model's
> >> Application.CreateItemFromTemplate() method, passing the path to the .oft
> >> file as the argument.
> >
> >> Replace() works the same no matter what text you use it on:
> >
> >> updatedText = Replace(originalText, findText, replaceText)
> >
> >> If you have problems making that work with your variables, post your
> >> existing code.
> >
> >> There's a detailed example in my book, which is available on Google
> >> Books.
> >
> >> "Simon Hughes (ICSNET UK)"
> >> <SimonHughesICSNETUK
> >> wrote in message
> >> news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> >> > Hi Sue,
> >> >> > Thanks for your reply, very helpful.
> >> >> > However, I am quite new to VBA and I am a little unsure of how to code
> >> > the
> >> > Replace() function and how to call the oft templete to open and inset
> >> > the
> >> > email address.
> >> >> > I ok with calling a new email message and sending the to,cc,bbc,
> >> > subject
> >> > and
> >> > body and even HTMLBody although not sure of the replace function.
> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> An Outlook .oft file doesn't have bookmarks. You have two choices
> >> >> here:
> >> >
> >> >> 1) Use a Word document as the starting point, and use the code
> >> >> technique
> >> >> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to
> >> >> generate
> >> >> the
> >> >> email messages.
> >> >
> >> >> -or-
> >> >
> >> >> 2) Use placeholder text in your .oft file to mark the locations where
> >> >> you
> >> >> want to replace that placeholder text with, for example, the date and
> >> >> time.
> >> >
> >> >> #2 is easier. Just call the Replace() function on the item's HTMLBody
> >> >> property as needed.
> >> >
> >> >> > >> >> Sue Mosher
> >> >> > >> >> > >> >> > >> >
> >> >
> >> >> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> >> >> UK)> wrote in message
> >> >> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> >> >> >I run a small home run I.T. Support company any have developed an
> >> >> >Access
> >> >> >2007
> >> >> > database for all our business activities. I currently send email
> >> >> > using
> >> >> > a
> >> >> > VBA
> >> >> > script although it does not allow me to be as flexible as I would
> >> >> > like.
> >> >> >> >> > I often send emails to customers where I would like to have a good
> >> >> > looking
> >> >> > email, as I have created an outlook template (oft) with our logo and
> >> >> > the
> >> >> > formatting just as I want it.
> >> >> >> >> > An example of our requirement is to be able to add a time and date
> >> >> > value
> >> >> > from an access form into one of these templates, along with
> >> >> > initially
> >> >> > opening
> >> >> > the template, then adding the email address again from a record
> >> >> > value
> >> >> > in
> >> >> > the
> >> >> > access form.
> >> >> >> >> > My idea was to do it in a similar way to how we achieve sending data
> >> >> > to
> >> >> > a
> >> >> > Word 2007 template - by using bookmarks. This would allow us to
> >> >> > preformat
> >> >> > the
> >> >> > standard emails in a oft template file and then simply drop the
> >> >> > required
> >> >> > data
> >> >> > from the Access form into it at the bookmark locations.
> >> >> > Do you know where I can go with this, as I've spent hours crawling
> >> >> > the
> >> >> > forums and have hit a wall!!
> >> >> >> >> > Look forward to your reply.
> >> >
> >> >
> >> >> .
> >> >
> >
> >
> >> .
> >>


> .
>
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Do you have some particular questions? If not, then perhaps you should

implement the specific example in the book and step through its code in the

debugger, so you can get a better sense of how it all comes together.

Sue Mosher

"Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
wrote in message news:3F488254-D70F-4952-BE89-A9B1D2A70411@microsoft.com...
> Hi Sue,

> I have been reading through your book although I seem unable to grasp the
> idea of writing the VBA for opening a oft file and utilising the replace
> function.

> I want to be able to send an email address to the email once the vba has
> opened it, then replace some data with data from a MS Access form which is
> where the vba is going to be initiated from.

> Could you help at all?

> Simon

> "Sue Mosher [MVP]" wrote:
>
> > 17.4.2 - Creating a message from a boilerplate template
>

>> "Simon Hughes (ICSNET UK)"
> > <SimonHughesICSNETUK
>> wrote in message
> > news:041E5D36-A86F-459D-8938-E5EAFFD592EB@microsoft.com...
> > > Hi Sue,
> >> > I appreciate your reply. I have just bought your book from Amazon am I
> > > am
> > > expecting deliver on Thursday. Hopefully I can learn a thing or two
> > > from
> > > it !!
> >> > Which part of the book contains the sample code relating to my query?
> >> > Simon
> >> > "Sue Mosher [MVP]" wrote:
> >> >> To create a new message from an .oft file, use the Outlook object
> > >> model's
> > >> Application.CreateItemFromTemplate() method, passing the path to the
> > >> .oft
> > >> file as the argument.
> > >
>> >> Replace() works the same no matter what text you use it on:
> > >
>> >> updatedText = Replace(originalText, findText, replaceText)
> > >
>> >> If you have problems making that work with your variables, post your
> > >> existing code.
> > >
>> >> There's a detailed example in my book, which is available on Google
> > >> Books.
> > >
>> >> "Simon Hughes (ICSNET UK)"
> > >> <SimonHughesICSNETUK
>> >> wrote in message
> > >> news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> > >> > Hi Sue,
> > >>> >> > Thanks for your reply, very helpful.
> > >>> >> > However, I am quite new to VBA and I am a little unsure of how to
> > >> > code
> > >> > the
> > >> > Replace() function and how to call the oft templete to open and
> > >> > inset
> > >> > the
> > >> > email address.
> > >>> >> > I ok with calling a new email message and sending the to,cc,bbc,
> > >> > subject
> > >> > and
> > >> > body and even HTMLBody although not sure of the replace function.
> > >>> >> > "Sue Mosher [MVP]" wrote:
> > >>> >> >> An Outlook .oft file doesn't have bookmarks. You have two choices
> > >> >> here:
> > >> >
>> >> >> 1) Use a Word document as the starting point, and use the code
> > >> >> technique
> > >> >> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to
> > >> >> generate
> > >> >> the
> > >> >> email messages.
> > >> >
>> >> >> -or-
> > >> >
>> >> >> 2) Use placeholder text in your .oft file to mark the locations
> > >> >> where
> > >> >> you
> > >> >> want to replace that placeholder text with, for example, the date
> > >> >> and
> > >> >> time.
> > >> >
>> >> >> #2 is easier. Just call the Replace() function on the item's
> > >> >> HTMLBody
> > >> >> property as needed.
> > >> >
>> >> >> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> > >> >> UK)> wrote in message
> > >> >> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> > >> >> >I run a small home run I.T. Support company any have developed an
> > >> >> >Access
> > >> >> >2007
> > >> >> > database for all our business activities. I currently send email
> > >> >> > using
> > >> >> > a
> > >> >> > VBA
> > >> >> > script although it does not allow me to be as flexible as I would
> > >> >> > like.
> > >> >>> >> >> > I often send emails to customers where I would like to have a
> > >> >> > good
> > >> >> > looking
> > >> >> > email, as I have created an outlook template (oft) with our logo
> > >> >> > and
> > >> >> > the
> > >> >> > formatting just as I want it.
> > >> >>> >> >> > An example of our requirement is to be able to add a time and
> > >> >> > date
> > >> >> > value
> > >> >> > from an access form into one of these templates, along with
> > >> >> > initially
> > >> >> > opening
> > >> >> > the template, then adding the email address again from a record
> > >> >> > value
> > >> >> > in
> > >> >> > the
> > >> >> > access form.
> > >> >>> >> >> > My idea was to do it in a similar way to how we achieve sending
> > >> >> > data
> > >> >> > to
> > >> >> > a
> > >> >> > Word 2007 template - by using bookmarks. This would allow us to
> > >> >> > preformat
> > >> >> > the
> > >> >> > standard emails in a oft template file and then simply drop the
> > >> >> > required
> > >> >> > data
> > >> >> > from the Access form into it at the bookmark locations.
> > >> >> > Do you know where I can go with this, as I've spent hours
> > >> >> > crawling
> > >> >> > the
> > >> >> > forums and have hit a wall!!
> > >> >>> >> >> > Look forward to your reply.
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Hi Sue,

Sorry for the unclear question.

What I was getting at was, the article in the book seemed to be aimed at

programatically replying to an email already received rather than generating

a new message from VBA in Access and inserting data from the DB into the

email template that I somehow need to open from VBA.

Hope this is a little clearer.

Regards,

Simon Hughes

ICSNET UK

t: 01495 70 80 90

m: 07747 41 41 41

"Sue Mosher [MVP]" wrote:


> Do you have some particular questions? If not, then perhaps you should
> implement the specific example in the book and step through its code in the
> debugger, so you can get a better sense of how it all comes together.
> > Sue Mosher
> > >

> "Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
> wrote in message news:3F488254-D70F-4952-BE89-A9B1D2A70411@microsoft.com...
> > Hi Sue,
> > I have been reading through your book although I seem unable to grasp the
> > idea of writing the VBA for opening a oft file and utilising the replace
> > function.
> > I want to be able to send an email address to the email once the vba has
> > opened it, then replace some data with data from a MS Access form which is
> > where the vba is going to be initiated from.
> > Could you help at all?
> > Simon
> > "Sue Mosher [MVP]" wrote:
> >
> >> 17.4.2 - Creating a message from a boilerplate template
> >
> >> "Simon Hughes (ICSNET UK)"
> >> <SimonHughesICSNETUK
> >> wrote in message
> >> news:041E5D36-A86F-459D-8938-E5EAFFD592EB@microsoft.com...
> >> > Hi Sue,
> >> >> > I appreciate your reply. I have just bought your book from Amazon am I
> >> > am
> >> > expecting deliver on Thursday. Hopefully I can learn a thing or two
> >> > from
> >> > it !!
> >> >> > Which part of the book contains the sample code relating to my query?
> >> >> > Simon
> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> To create a new message from an .oft file, use the Outlook object
> >> >> model's
> >> >> Application.CreateItemFromTemplate() method, passing the path to the
> >> >> .oft
> >> >> file as the argument.
> >> >
> >> >> Replace() works the same no matter what text you use it on:
> >> >
> >> >> updatedText = Replace(originalText, findText, replaceText)
> >> >
> >> >> If you have problems making that work with your variables, post your
> >> >> existing code.
> >> >
> >> >> There's a detailed example in my book, which is available on Google
> >> >> Books.
> >> >
> >> >> "Simon Hughes (ICSNET UK)"
> >> >> <SimonHughesICSNETUK
> >> >> wrote in message
> >> >> news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> >> >> > Hi Sue,
> >> >> >> >> > Thanks for your reply, very helpful.
> >> >> >> >> > However, I am quite new to VBA and I am a little unsure of how to
> >> >> > code
> >> >> > the
> >> >> > Replace() function and how to call the oft templete to open and
> >> >> > inset
> >> >> > the
> >> >> > email address.
> >> >> >> >> > I ok with calling a new email message and sending the to,cc,bbc,
> >> >> > subject
> >> >> > and
> >> >> > body and even HTMLBody although not sure of the replace function.
> >> >> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> >> >> An Outlook .oft file doesn't have bookmarks. You have two choices
> >> >> >> here:
> >> >> >
> >> >> >> 1) Use a Word document as the starting point, and use the code
> >> >> >> technique
> >> >> >> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to
> >> >> >> generate
> >> >> >> the
> >> >> >> email messages.
> >> >> >
> >> >> >> -or-
> >> >> >
> >> >> >> 2) Use placeholder text in your .oft file to mark the locations
> >> >> >> where
> >> >> >> you
> >> >> >> want to replace that placeholder text with, for example, the date
> >> >> >> and
> >> >> >> time.
> >> >> >
> >> >> >> #2 is easier. Just call the Replace() function on the item's
> >> >> >> HTMLBody
> >> >> >> property as needed.
> >> >> >
> >> >> >> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> >> >> >> UK)> wrote in message
> >> >> >> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> >> >> >> >I run a small home run I.T. Support company any have developed an
> >> >> >> >Access
> >> >> >> >2007
> >> >> >> > database for all our business activities. I currently send email
> >> >> >> > using
> >> >> >> > a
> >> >> >> > VBA
> >> >> >> > script although it does not allow me to be as flexible as I would
> >> >> >> > like.
> >> >> >> >> >> >> > I often send emails to customers where I would like to have a
> >> >> >> > good
> >> >> >> > looking
> >> >> >> > email, as I have created an outlook template (oft) with our logo
> >> >> >> > and
> >> >> >> > the
> >> >> >> > formatting just as I want it.
> >> >> >> >> >> >> > An example of our requirement is to be able to add a time and
> >> >> >> > date
> >> >> >> > value
> >> >> >> > from an access form into one of these templates, along with
> >> >> >> > initially
> >> >> >> > opening
> >> >> >> > the template, then adding the email address again from a record
> >> >> >> > value
> >> >> >> > in
> >> >> >> > the
> >> >> >> > access form.
> >> >> >> >> >> >> > My idea was to do it in a similar way to how we achieve sending
> >> >> >> > data
> >> >> >> > to
> >> >> >> > a
> >> >> >> > Word 2007 template - by using bookmarks. This would allow us to
> >> >> >> > preformat
> >> >> >> > the
> >> >> >> > standard emails in a oft template file and then simply drop the
> >> >> >> > required
> >> >> >> > data
> >> >> >> > from the Access form into it at the bookmark locations.
> >> >> >> > Do you know where I can go with this, as I've spent hours
> >> >> >> > crawling
> >> >> >> > the
> >> >> >> > forums and have hit a wall!!
> >> >> >> >> >> >> > Look forward to your reply.


> .
>
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Sue's off for a few days.

To create a brand new blank email item and have a reference available to it

for adding data from a DB your code would start like this, assuming you have

an Outlook.Application object oOL:

Dim oMail As Outlook.MailItem

Set oMail = oOL.CreateItem(olMailItem)

You then add whatever properties you want from the DB information such as

Subject or Body or HTMLBody, etc. You can get the Recipients collection of

the mail item and add one or more recipients to that, etc.

"Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
wrote in message news:0F078A9B-24B4-40D4-9BF4-103741E0B518@microsoft.com...
> Hi Sue,

> Sorry for the unclear question.

> What I was getting at was, the article in the book seemed to be aimed at
> programatically replying to an email already received rather than
> generating
> a new message from VBA in Access and inserting data from the DB into the
> email template that I somehow need to open from VBA.

> Hope this is a little clearer.

> Regards,

> Simon Hughes
> ICSNET UK
> t: 01495 70 80 90
> m: 07747 41 41 41
>
 
Sending Email from Access

To Simon Hughes, I am very interested in how you built your email using the VBA script and would like to know how you have it working in concert with Access. I'm trying to figure out a way to send an email from access (theoretically) that would insert specific field information (names, customer names, etc) automatically based on clicking a button or running a macro/script. Kind of like using a Word mail merge that inserts names and addresses, etc.

Thanks, Laura

Simon Hughes (ICSNET UK) wrote:

Sending Email from Access 2007 through Outlook 2007 using template

16-Jan-10

I run a small home run I.T. Support company any have developed an Access 2007

database for all our business activities. I currently send email using a VBA

script although it does not allow me to be as flexible as I would like.

I often send emails to customers where I would like to have a good looking

email, as I have created an outlook template (oft) with our logo and the

formatting just as I want it.

An example of our requirement is to be able to add a time and date value

from an access form into one of these templates, along with initially opening

the template, then adding the email address again from a record value in the

access form.

My idea was to do it in a similar way to how we achieve sending data to a

Word 2007 template - by using bookmarks. This would allow us to preformat the

standard emails in a oft template file and then simply drop the required data

from the Access form into it at the bookmark locations.

Do you know where I can go with this, as I have spent hours crawling the

forums and have hit a wall!!

Look forward to your reply.

Previous Posts In This Thread:

On Saturday, January 16, 2010 7:49 AM

Simon Hughes (ICSNET UK) wrote:

Sending Email from Access 2007 through Outlook 2007 using template

I run a small home run I.T. Support company any have developed an Access 2007

database for all our business activities. I currently send email using a VBA

script although it does not allow me to be as flexible as I would like.

I often send emails to customers where I would like to have a good looking

email, as I have created an outlook template (oft) with our logo and the

formatting just as I want it.

An example of our requirement is to be able to add a time and date value

from an access form into one of these templates, along with initially opening

the template, then adding the email address again from a record value in the

access form.

My idea was to do it in a similar way to how we achieve sending data to a

Word 2007 template - by using bookmarks. This would allow us to preformat the

standard emails in a oft template file and then simply drop the required data

from the Access form into it at the bookmark locations.

Do you know where I can go with this, as I have spent hours crawling the

forums and have hit a wall!!

Look forward to your reply.

On Saturday, January 16, 2010 8:45 AM

Sue Mosher [MVP] wrote:

An Outlook .oft file does not have bookmarks.

An Outlook .oft file does not have bookmarks. You have two choices here:

1) Use a Word document as the starting point, and use the code technique

shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to generate the

email messages.

-or-

2) Use placeholder text in your .oft file to mark the locations where you

want to replace that placeholder text with, for example, the date and time.

property as needed.

Sue Mosher

"Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET

On Sunday, January 17, 2010 6:24 AM

Simon Hughes (ICSNET UK) wrote:

Hi Sue,Thanks for your reply, very helpful.

Hi Sue,

Thanks for your reply, very helpful.

However, I am quite new to VBA and I am a little unsure of how to code the

Replace() function and how to call the oft templete to open and inset the

email address.

I ok with calling a new email message and sending the to,cc,bbc, subject and

body and even HTMLBody although not sure of the replace function.

Could you help at all, maybe you have an example that you have worked with

previously to point me in the right direction?

Thanks in advance.

Simon

"Sue Mosher [MVP]" wrote:

On Sunday, January 17, 2010 9:38 AM

Sue Mosher [MVP] wrote:

To create a new message from an .

To create a new message from an .oft file, use the Outlook object model's

Application.CreateItemFromTemplate() method, passing the path to the .oft

file as the argument.

Replace() works the same no matter what text you use it on:

updatedText = Replace(originalText, findText, replaceText)

If you have problems making that work with your variables, post your

existing code.

There is a detailed example in my book, which is available on Google Books.

Sue Mosher

On Tuesday, January 19, 2010 2:39 PM

Simon Hughes (ICSNET UK) wrote:

Hi Sue,I appreciate your reply.

Hi Sue,

I appreciate your reply. I have just bought your book from Amazon am I am

expecting deliver on Thursday. Hopefully I can learn a thing or two from it !!

Which part of the book contains the sample code relating to my query?

Simon

"Sue Mosher [MVP]" wrote:

On Tuesday, January 19, 2010 3:12 PM

Sue Mosher [MVP] wrote:

17.4.

17.4.2 - Creating a message from a boilerplate template

Sue Mosher

On Wednesday, February 03, 2010 5:42 PM

Simon Hughes (ICSNET UK) wrote:

Hi Sue,I have been reading through your book although I seem unable to grasp

Hi Sue,

I have been reading through your book although I seem unable to grasp the

idea of writing the VBA for opening a oft file and utilising the replace

function.

I want to be able to send an email address to the email once the vba has

opened it, then replace some data with data from a MS Access form which is

where the vba is going to be initiated from.

Could you help at all?

Simon

"Sue Mosher [MVP]" wrote:

On Wednesday, February 03, 2010 6:04 PM

Sue Mosher [MVP] wrote:

Do you have some particular questions?

Do you have some particular questions? If not, then perhaps you should

implement the specific example in the book and step through its code in the

debugger, so you can get a better sense of how it all comes together.

Sue Mosher

On Friday, February 05, 2010 8:22 AM

Simon Hughes (ICSNET UK) wrote:

Hi Sue,Sorry for the unclear question.

Hi Sue,

Sorry for the unclear question.

What I was getting at was, the article in the book seemed to be aimed at

programatically replying to an email already received rather than generating

a new message from VBA in Access and inserting data from the DB into the

email template that I somehow need to open from VBA.

Hope this is a little clearer.

Regards,

Simon Hughes

ICSNET UK

t: 01495 70 80 90

m: 07747 41 41 41

"Sue Mosher [MVP]" wrote:

On Friday, February 05, 2010 9:29 AM
- wrote:

Sue's off for a few days.

Sue's off for a few days.

To create a brand new blank email item and have a reference available to it

for adding data from a DB your code would start like this, assuming you have

an Outlook.Application object oOL:

Dim oMail As Outlook.MailItem

Set oMail = oOL.CreateItem(olMailItem)

You then add whatever properties you want from the DB information such as

Subject or Body or HTMLBody, etc. You can get the Recipients collection of

the mail item and add one or more recipients to that, etc.

WPF Custom Validation Using the Enterprise Library

http://www.eggheadcafe.com/tutorial...c-33ef1ec7d1a3/wpf-custom-validation-usi.aspx
 
Re: Sending Email from Access 2007 through Outlook 2007 using temp

Hi Sue,

I have implemented code to open (with help from your book) an OFT, pass data

from placeholders in the template from my MS Access Database.

The code does open the template and display it although the data is not

passed. The code runs without error ???

Hope you don't mind, I have copied the code below >>
#########################################

Sub EmailEInvoice_w_balance()

Dim myOlApp As Outlook.Application

Dim MyItem As Outlook.MailItem

Dim objDoc As Object

Dim OutlookRecip As String

Dim strCustomer As String

Dim strHTML As String

Set myOlApp = CreateObject("Outlook.Application")

Set MyItem =

myOlApp.CreateItemFromTemplate("C:\EmailTemplates\EInvoice_withbalance.oft")

strCustomer = "Simon"

strHTML = Replace(MyItem.HTMLBody,"%subfirstname%", strCustomer)

MyItem.Display

Set objDoc = MyItem.GetInspector.WordEditor

objDoc.Windows(1).Selection.Find.ClearFormatting

objDoc.Windows(1).Selection.Find.Execute strSender

Set myOlApp = Nothing

Set MyItem = Nothing

Set objDoc = Nothing

End Sub

###################################

"Sue Mosher [MVP]" wrote:


> Do you have some particular questions? If not, then perhaps you should
> implement the specific example in the book and step through its code in the
> debugger, so you can get a better sense of how it all comes together.
> > Sue Mosher
> > >

> "Simon Hughes (ICSNET UK)" <SimonHughesICSNETUK
> wrote in message news:3F488254-D70F-4952-BE89-A9B1D2A70411@microsoft.com...
> > Hi Sue,
> > I have been reading through your book although I seem unable to grasp the
> > idea of writing the VBA for opening a oft file and utilising the replace
> > function.
> > I want to be able to send an email address to the email once the vba has
> > opened it, then replace some data with data from a MS Access form which is
> > where the vba is going to be initiated from.
> > Could you help at all?
> > Simon
> > "Sue Mosher [MVP]" wrote:
> >
> >> 17.4.2 - Creating a message from a boilerplate template
> >
> >> "Simon Hughes (ICSNET UK)"
> >> <SimonHughesICSNETUK
> >> wrote in message
> >> news:041E5D36-A86F-459D-8938-E5EAFFD592EB@microsoft.com...
> >> > Hi Sue,
> >> >> > I appreciate your reply. I have just bought your book from Amazon am I
> >> > am
> >> > expecting deliver on Thursday. Hopefully I can learn a thing or two
> >> > from
> >> > it !!
> >> >> > Which part of the book contains the sample code relating to my query?
> >> >> > Simon
> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> To create a new message from an .oft file, use the Outlook object
> >> >> model's
> >> >> Application.CreateItemFromTemplate() method, passing the path to the
> >> >> .oft
> >> >> file as the argument.
> >> >
> >> >> Replace() works the same no matter what text you use it on:
> >> >
> >> >> updatedText = Replace(originalText, findText, replaceText)
> >> >
> >> >> If you have problems making that work with your variables, post your
> >> >> existing code.
> >> >
> >> >> There's a detailed example in my book, which is available on Google
> >> >> Books.
> >> >
> >> >> "Simon Hughes (ICSNET UK)"
> >> >> <SimonHughesICSNETUK
> >> >> wrote in message
> >> >> news:B306E880-0CEC-476B-A936-A8A2B63FC0EE@microsoft.com...
> >> >> > Hi Sue,
> >> >> >> >> > Thanks for your reply, very helpful.
> >> >> >> >> > However, I am quite new to VBA and I am a little unsure of how to
> >> >> > code
> >> >> > the
> >> >> > Replace() function and how to call the oft templete to open and
> >> >> > inset
> >> >> > the
> >> >> > email address.
> >> >> >> >> > I ok with calling a new email message and sending the to,cc,bbc,
> >> >> > subject
> >> >> > and
> >> >> > body and even HTMLBody although not sure of the replace function.
> >> >> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> >> >> An Outlook .oft file doesn't have bookmarks. You have two choices
> >> >> >> here:
> >> >> >
> >> >> >> 1) Use a Word document as the starting point, and use the code
> >> >> >> technique
> >> >> >> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to
> >> >> >> generate
> >> >> >> the
> >> >> >> email messages.
> >> >> >
> >> >> >> -or-
> >> >> >
> >> >> >> 2) Use placeholder text in your .oft file to mark the locations
> >> >> >> where
> >> >> >> you
> >> >> >> want to replace that placeholder text with, for example, the date
> >> >> >> and
> >> >> >> time.
> >> >> >
> >> >> >> #2 is easier. Just call the Replace() function on the item's
> >> >> >> HTMLBody
> >> >> >> property as needed.
> >> >> >
> >> >> >> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET
> >> >> >> UK)> wrote in message
> >> >> >> news:429E4BCB-4A06-40DB-9C04-CEF1C6FE08C5@microsoft.com...
> >> >> >> >I run a small home run I.T. Support company any have developed an
> >> >> >> >Access
> >> >> >> >2007
> >> >> >> > database for all our business activities. I currently send email
> >> >> >> > using
> >> >> >> > a
> >> >> >> > VBA
> >> >> >> > script although it does not allow me to be as flexible as I would
> >> >> >> > like.
> >> >> >> >> >> >> > I often send emails to customers where I would like to have a
> >> >> >> > good
> >> >> >> > looking
> >> >> >> > email, as I have created an outlook template (oft) with our logo
> >> >> >> > and
> >> >> >> > the
> >> >> >> > formatting just as I want it.
> >> >> >> >> >> >> > An example of our requirement is to be able to add a time and
> >> >> >> > date
> >> >> >> > value
> >> >> >> > from an access form into one of these templates, along with
> >> >> >> > initially
> >> >> >> > opening
> >> >> >> > the template, then adding the email address again from a record
> >> >> >> > value
> >> >> >> > in
> >> >> >> > the
> >> >> >> > access form.
> >> >> >> >> >> >> > My idea was to do it in a similar way to how we achieve sending
> >> >> >> > data
> >> >> >> > to
> >> >> >> > a
> >> >> >> > Word 2007 template - by using bookmarks. This would allow us to
> >> >> >> > preformat
> >> >> >> > the
> >> >> >> > standard emails in a oft template file and then simply drop the
> >> >> >> > required
> >> >> >> > data
> >> >> >> > from the Access form into it at the bookmark locations.
> >> >> >> > Do you know where I can go with this, as I've spent hours
> >> >> >> > crawling
> >> >> >> > the
> >> >> >> > forums and have hit a wall!!
> >> >> >> >> >> >> > Look forward to your reply.


> .
>
 
RE: Sending Email from Access

Hi Laura,

I would be happy to help you with this. If you would like to email me

directly at simon@icsnet.co.uk I can see what I can do to help !!

Simon :)

"Laura Sheldon" wrote:


> To Simon Hughes, I am very interested in how you built your email using the VBA script and would like to know how you have it working in concert with Access. I'm trying to figure out a way to send an email from access (theoretically) that would insert specific field information (names, customer names, etc) automatically based on clicking a button or running a macro/script. Kind of like using a Word mail merge that inserts names and addresses, etc.

> Thanks, Laura

> Simon Hughes (ICSNET UK) wrote:

> Sending Email from Access 2007 through Outlook 2007 using template
> 16-Jan-10

> I run a small home run I.T. Support company any have developed an Access 2007
> database for all our business activities. I currently send email using a VBA
> script although it does not allow me to be as flexible as I would like.

> I often send emails to customers where I would like to have a good looking
> email, as I have created an outlook template (oft) with our logo and the
> formatting just as I want it.

> An example of our requirement is to be able to add a time and date value
> from an access form into one of these templates, along with initially opening
> the template, then adding the email address again from a record value in the
> access form.

> My idea was to do it in a similar way to how we achieve sending data to a
> Word 2007 template - by using bookmarks. This would allow us to preformat the
> standard emails in a oft template file and then simply drop the required data
> from the Access form into it at the bookmark locations.
> Do you know where I can go with this, as I have spent hours crawling the
> forums and have hit a wall!!

> Look forward to your reply.

> Previous Posts In This Thread:

> On Saturday, January 16, 2010 7:49 AM
> Simon Hughes (ICSNET UK) wrote:

> Sending Email from Access 2007 through Outlook 2007 using template
> I run a small home run I.T. Support company any have developed an Access 2007
> database for all our business activities. I currently send email using a VBA
> script although it does not allow me to be as flexible as I would like.

> I often send emails to customers where I would like to have a good looking
> email, as I have created an outlook template (oft) with our logo and the
> formatting just as I want it.

> An example of our requirement is to be able to add a time and date value
> from an access form into one of these templates, along with initially opening
> the template, then adding the email address again from a record value in the
> access form.

> My idea was to do it in a similar way to how we achieve sending data to a
> Word 2007 template - by using bookmarks. This would allow us to preformat the
> standard emails in a oft template file and then simply drop the required data
> from the Access form into it at the bookmark locations.
> Do you know where I can go with this, as I have spent hours crawling the
> forums and have hit a wall!!

> Look forward to your reply.

> On Saturday, January 16, 2010 8:45 AM
> Sue Mosher [MVP] wrote:

> An Outlook .oft file does not have bookmarks.
> An Outlook .oft file does not have bookmarks. You have two choices here:

> 1) Use a Word document as the starting point, and use the code technique
> shown at http://www.outlookcode.com/codedetail.aspx?id=1333 to generate the
> email messages.

> -or-

> 2) Use placeholder text in your .oft file to mark the locations where you
> want to replace that placeholder text with, for example, the date and time.

> property as needed.

> > Sue Mosher
> >

> "Simon Hughes (ICSNET UK)" <Simon Hughes (ICSNET

> On Sunday, January 17, 2010 6:24 AM
> Simon Hughes (ICSNET UK) wrote:

> Hi Sue,Thanks for your reply, very helpful.
> Hi Sue,

> Thanks for your reply, very helpful.

> However, I am quite new to VBA and I am a little unsure of how to code the
> Replace() function and how to call the oft templete to open and inset the
> email address.

> I ok with calling a new email message and sending the to,cc,bbc, subject and
> body and even HTMLBody although not sure of the replace function.

> Could you help at all, maybe you have an example that you have worked with
> previously to point me in the right direction?

> Thanks in advance.

> Simon

> "Sue Mosher [MVP]" wrote:

> On Sunday, January 17, 2010 9:38 AM
> Sue Mosher [MVP] wrote:

> To create a new message from an .
> To create a new message from an .oft file, use the Outlook object model's
> Application.CreateItemFromTemplate() method, passing the path to the .oft
> file as the argument.

> Replace() works the same no matter what text you use it on:

> updatedText = Replace(originalText, findText, replaceText)

> If you have problems making that work with your variables, post your
> existing code.

> There is a detailed example in my book, which is available on Google Books.
> > Sue Mosher
> > > On Tuesday, January 19, 2010 2:39 PM
> Simon Hughes (ICSNET UK) wrote:

> Hi Sue,I appreciate your reply.
> Hi Sue,

> I appreciate your reply. I have just bought your book from Amazon am I am
> expecting deliver on Thursday. Hopefully I can learn a thing or two from it !!

> Which part of the book contains the sample code relating to my query?

> Simon

> "Sue Mosher [MVP]" wrote:

> On Tuesday, January 19, 2010 3:12 PM
> Sue Mosher [MVP] wrote:

> 17.4.
> 17.4.2 - Creating a message from a boilerplate template

> > Sue Mosher
> > > On Wednesday, February 03, 2010 5:42 PM
> Simon Hughes (ICSNET UK) wrote:

> Hi Sue,I have been reading through your book although I seem unable to grasp
> Hi Sue,

> I have been reading through your book although I seem unable to grasp the
> idea of writing the VBA for opening a oft file and utilising the replace
> function.

> I want to be able to send an email address to the email once the vba has
> opened it, then replace some data with data from a MS Access form which is
> where the vba is going to be initiated from.

> Could you help at all?

> Simon

> "Sue Mosher [MVP]" wrote:

> On Wednesday, February 03, 2010 6:04 PM
> Sue Mosher [MVP] wrote:

> Do you have some particular questions?
> Do you have some particular questions? If not, then perhaps you should
> implement the specific example in the book and step through its code in the
> debugger, so you can get a better sense of how it all comes together.
> > Sue Mosher
> > > On Friday, February 05, 2010 8:22 AM
> Simon Hughes (ICSNET UK) wrote:

> Hi Sue,Sorry for the unclear question.
> Hi Sue,

> Sorry for the unclear question.

> What I was getting at was, the article in the book seemed to be aimed at
> programatically replying to an email already received rather than generating
> a new message from VBA in Access and inserting data from the DB into the
> email template that I somehow need to open from VBA.

> Hope this is a little clearer.

> Regards,

> Simon Hughes
> ICSNET UK
> t: 01495 70 80 90
> m: 07747 41 41 41

> "Sue Mosher [MVP]" wrote:

> On Friday, February 05, 2010 9:29 AM
> - wrote:

> Sue's off for a few days.
> Sue's off for a few days.

> To create a brand new blank email item and have a reference available to it
> for adding data from a DB your code would start like this, assuming you have
> an Outlook.Application object oOL:

> Dim oMail As Outlook.MailItem
> Set oMail = oOL.CreateItem(olMailItem)

> You then add whatever properties you want from the DB information such as
> Subject or Body or HTMLBody, etc. You can get the Recipients collection of
> the mail item and add one or more recipients to that, etc.

> >

>

> WPF Custom Validation Using the Enterprise Library
> http://www.eggheadcafe.com/tutorial...c-33ef1ec7d1a3/wpf-custom-validation-usi.aspx
> .
>
 
Re: Sending Email from Access

Laura Sheldon wrote:


> To Simon Hughes, I am very interested in how you built your email using the VBA script and would like to know how you have it working in concert with Access. I'm trying to figure out a way to send an email from access (theoretically) that would insert specific field information (names, customer names, etc) automatically based on clicking a button or running a macro/script. Kind of like using a Word mail merge that inserts names and addresses, etc.


Also see Microsoft Access Email FAQ

http://www.granite.ab.ca/access/email.htm

Tony

Tony Toews, Microsoft Access MVP

Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm

Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

For a convenient utility to keep your users FEs and other files

updated see http://www.autofeupdater.com/

Granite Fleet Manager http://www.granitefleet.com/
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Sending automatic email from Access using Outlook Outlook VBA and Custom Forms 1
D Prompt to prefix subject line whenever sending an email Outlook VBA and Custom Forms 3
P default font when sending email from browser Using Outlook 1
P Sending email from outlook IMAP to GMAIL where embedded images are added as attachment Using Outlook 1
D Sending email from Office 365 alias in Outlook Using Outlook 3
B Outlook 2003 email sending & receiving suddenly stopped working Using Outlook 3
HarvMan Hotmail - Sending email is undeliverable Using Outlook 4
D Adding Enterprise Exchange Email Account to Outlook Prevents Sending via Outlook.com Account Using Outlook.com accounts in Outlook 10
B When sending an email, I am showing 2 of my address's Using Outlook 1
M Auto expand Distribution List Before Sending Email Outlook VBA and Custom Forms 1
A Check for words in subject header before sending email Outlook VBA and Custom Forms 4
O Run macro automatically at sending an email Using Outlook 11
H Select Specific Account When Sending Email, Based on Current Folder Outlook VBA and Custom Forms 1
M Help sending email but removing signature via VBA Outlook VBA and Custom Forms 5
C address book "when sending email" bug? Using Outlook 0
R Sending email copy (*.msg file) of sent email if subject line contains specific string. Outlook VBA and Custom Forms 1
C replace subject line generated by converting a word document to PDF and sending it to an email Using Outlook 8
A Sending Emails Through Outlook From Multiple Email Addresses Using Outlook 1
X Delay sending an email until the next working day (public holidays) Outlook VBA and Custom Forms 0
P Outlook 2010 sending safe senders email to junk box Using Outlook 8
Diane Poremsky Warn before sending messages to the wrong email address Using Outlook 1
Dilshad VBA editor opens when sending an email Using Outlook 2
Diane Poremsky Sending Email from a Secondary Exchange Mailbox Using Outlook 0
Diane Poremsky Sending Email from a Secondary Exchange Mailbox Using Outlook 0
rohit I want to Populate Popup box while sending any email with attachment. Outlook VBA and Custom Forms 4
rohit I want to Populate Popup box while sending any email with attachment Using Outlook 1
J Is there a way to disallow sending from certain addresses to specific email addresses? Using Outlook 2
M Sending Excel Charts in the Body of an Email Using Outlook 1
A Application_ItemSend not accessed when sending email outside outlook (i.e. word or send to mail from Using Outlook 7
P Desktop Outlook not sending from alternative email Using Outlook.com accounts in Outlook 6
A After receiving the same email 3 times, Outlook starts sending it to junk Using Outlook 1
R Outlook not responding when sending email Using Outlook 1
T Sending One Email to Trigger Another Being Sent Using an Email within the 1st? Using Outlook 0
I How to prevent exchange email account from sending emails in Outlook Using Outlook 4
X Outlook 2003 not sending all of the new email message Using Outlook 1
O Choosing Sending Email Address from Word Using Outlook 5
P VBA for Dialog Box when sending Email Using Outlook 8
C email sending window won't go away even after email has sent Exchange Server Administration 2
M Outlook 2010 stuck in Work Offline mode; trouble sending email Using Outlook 1
S Changing "from" address when sending email Using Outlook 4
N Prompt for password when sending an email Exchange Server Administration 1
K How to split large email when sending Using Outlook 1
L Sending from a distribution list email Using Outlook 6
P Delayed mass email sending Using Outlook 2
M Links prevent sending email Using Outlook 3
A Send Email to Task while sending to Email address Outlook VBA and Custom Forms 1
S Email Help: Sending Outlook email from Excel VBA Outlook VBA and Custom Forms 6
R Sending a copy of an incoming email to a network folder Outlook VBA and Custom Forms 1
T Emails - sending and receiving multiple copies of the same email Using Outlook 4
C Prevent Outlook from sending an email with a blank Subject Line Outlook VBA and Custom Forms 3

Similar threads

Back
Top