Modules & VBA :: Run Outlook Function From Access

Mar 6, 2015

I have an Outlook Function that i am trying to run from Access.What i am looking for is to Open Outlook through Access and run the Outlook function from Access.

View Replies


ADVERTISEMENT

Modules & VBA :: Replace Function In Access 2007 For HTML Email In Outlook 2010

Aug 4, 2014

My company recently upgraded our MS Office from 2007 to 2010 (except for Access).

Previously, when I had Access 2007 and Outlook 2007, I had a process that generated 50+ dynamic emails from an Outlook template file (.oft).

The code would loop through a listbox and replace the template's default text to a string of text specific to the selection in the listbox by utilizing the Replace() function on the MailItem .HTMLBody.

Since the upgrade to Outlook 2010, the code is able to run, however, the Replace() function is no longer working; Instead, each email that is generated maintains the template's default text.

The only thing that is not working is the Replace() function, all other aspects of the code work fine.

I've provided a simplified version of the code below:

Dim myOlApp As Outlook.Application
Dim objMailMessage As MailItem
Dim stBody As String
Set myOlApp = Outlook.Application
Set objMailMessage = myOlApp.CreateItemFromTemplate("C:UsersDesktop emplate.oft")

[Code] .....

I've recreated the template file in Outlook 2010, thinking that the template created with Outlook 2007 would be the culprit, but to no avail.

What could have changed from Outlook 2007 to Outlook 2010 that would render my previously valid code ineffective?

Are there certain references I need to enable in both Access and Outlook to allow VBA in Access modify the content in an Outlook email?

View 12 Replies View Related

Modules & VBA :: MS Access To Open Outlook (MSG) File

Oct 20, 2014

when I open a .msg file using

dim x as long
x = Shell("""C:Program Files (x86)Microsoft OfficeOffice15Outlook.exe"" /f ""D:mymessage.msg""")

how to access the fields "To", "CC", "Subject", "Date", "Body text", etc ?

My problem: I have a lot of files .msg (about 1000) and I want to put them in a single file (preferably in txt).

View 7 Replies View Related

Modules & VBA :: Access Outlook Integration Using LastModificationTime

Sep 11, 2014

I am programmatically importing Outlook into Access and I want to restrict it to only those contacts that have been updated since the last import. My program has some date conversion or syntax flaw that I can't figure out. The important parts below...

DateStart = #1/1/1900#
DateStart = Nz(DMax("CMDBCreatedDateTime", "Outlook_Control"), #1/1/1900#)
MsgBox Format$(DateStart, "General Date")

[Code].....

View 3 Replies View Related

Modules & VBA :: Outlook Restrict Method From Access

Mar 13, 2015

I have the below script:

For Each Item In offexchfldr.Items.Restrict("[SenderName] = '" & frmfm & "'") ' Select Items that match Sender Name on form
If Item.TaskSubject = subid Then
Item.Categories = frmcat ' Update category from form to outlook
Item.Save
End If
Next

This script checks every item in the outlook inbox where the item.SenderName = my database sendername

This works every time except for when the sendername has quotes or single quotes in their name. So i am trying to utlize the replace method on the item sendername before trying to find the items in the inbox but its not working.

Below is my attempt that does not work.

For Each Item In offexchfldr.Items.Restrict("Replace([SenderName],',"") = '" & frmfm & "'") ' Select Items that match Sender Name on form

View 2 Replies View Related

Modules & VBA :: Select MS Outlook Theme From Access VBA

Feb 3, 2014

I build MS Access databases for small businesses. Generating emails from within Access is no problem - I can even use Access VBA to select specific email accounts and email signatures. However, I have not been able to find a way to use Access VBA to select a Theme that was set up in Outlook. If I create a Theme using the Outlook 2010 menu selections: Options / Mail / Stationery and Fonts / Theme, that theme is present every time I generate a new email from within Outlook. But if I generate a new email via Access VBA, that theme is no longer present - the email that VBA generates has no Theme. What Access VBA code do I need to use to select an Outlook Theme - even just the default Outlook Theme?

One thought is that if someone knows the keyboard shortcuts to select an Outlook Theme, I can do the rest. I can use SendKeys. But if there is a more sophisticated way of making the Theme appear on emails generated by Access VBA, I am eager to learn.

I am using Access 2010, by the way.

View 2 Replies View Related

Modules & VBA :: Retrieve Outlook Data From Access

Feb 6, 2015

It's been some time since I wrote the following, which takes a string made up of "Lastname Firstname Telephone" and writes it at a specific time in Outlook. It uses Late binding so it works across all Oulook versions.

Code:
Public Function funOutputAppointmentToOutlook(dtmDate As Date, strSubject As String)
Dim olApp As Object
Dim mNameSpace As Object
Const olFolderCalendar = 9
Const olAppointmentItem = 1

[Code] ....

I would like to first check the specific Outlook time slot whether the string exists already and only if it does not exist to write it.

View 1 Replies View Related

Modules & VBA :: Open Access Database From Outlook

Jan 18, 2015

I use the below code to open an access database, but it opens for a second and then closes. When I run the same code from excel, it works OK.

Code:
Sub OpenDatabase1()
Dim LPath As String
Dim LCategoryID As Long

[code]....

View 6 Replies View Related

Modules & VBA :: Add Appointment To Shared Outlook Calendar Using Access

Aug 19, 2014

I am very new to VBA. I found some code that will allow me to add an appointment to my personal calendar with using access VBA and it works great. It also allows me to add an appointment to another calendar created under "My Calendars" folder.

I wanted to know how to change the code in order to add the appointment to the SHARED calendar instead.

The main folder is called "Shared Calendars" which is at the same level as the default "My Calendars" folder. Under the "Shared Calendars" folder the calendar is called "Tester".

Here is the code im using at the moment: I believe I have have to change the line of code that is in red but I don't know how.

Private Sub cmdAddAppt_Click()
On Error GoTo cmdAddAppt_Err
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Dim olNS As Outlook.NameSpace

[Code] ....

View 1 Replies View Related

Modules & VBA :: Showing In Access If Email In Outlook Has Attachment

Oct 15, 2014

I found a code that will go trough an emailbox and export all emails to a table in access. This part is working OK (except the received date). I also wante to show in the table if the email contains an attachment, but that part is not working at all. The project actually is meant to store the emails on a shared drive and attachments and have the emails in Access so I can see them all and recall the one needed.

Code:
Private Sub Command14_Click()
Dim TempRst As DAO.Recordset
Dim rst As DAO.Recordset

[Code].....

View 8 Replies View Related

Modules & VBA :: Add Single Outlook Contact To Access Form

Jan 8, 2014

Microsoft has a Desktop Student Database template (Access 2010) that does exactly what I'm trying to do:

open the Outlook Contacts dialog box, select a contact from the GAL, and then programmatically save it to a record in one of my tables.

I've tried simulating the button/coding on my data entry form, but I'm getting the error:

"The command or action 'AddFromOutlook' isn't available now"

I've search high and low but have only found a reference to creating a temp contacts table to import all the contacts.

View 2 Replies View Related

Modules & VBA :: Access Email With Embedded Image Using Outlook

Sep 29, 2013

I have code that automatically send emails out from an Access Customer Contacts Database. I am using Access and Outlook 2007 but the code needs to work with later versions of Access and Outlook.

I have very poor knowledge of coding and usually manage to cobble something together from looking at other code on the net but don't understand most of it.

I have the following code which works perfectly except I want to be able to embed an image in the email body (not have the image as an attachment but actually show it in the body of the email).

Most of the code I have found around this topic is too complex for me to understand and utilise within the context of the code I have.

Ideally I want to take the image from an attachment field in a table returned by the "tblMailingList_Query".

Code:
Private Sub Command10_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem

[Code] .....

View 2 Replies View Related

Modules & VBA :: How To Log Into A Specific Outlook User Account In Access

Aug 6, 2013

How to log into a specific outlook user account and then send an email from that account ? I need the code

At the moment i can only get it to send emails from the account my outlook logs into by default ie my own profile's account.

View 12 Replies View Related

Modules & VBA :: How To Get Access To Make Appointment To A Specific Calendar On Outlook

Dec 4, 2014

I have been able to successfully set up code to be able to add appointments to microsoft outlook based on data within a few forms that I have. My question is this however, how do I get access to make that appointment to a specific calendar on outlook. This calendar is a shared calendar. Currently, access is just adding the appointments to "My Calendar" and I could like it to place the appointment on "HVCalendar". a version of the code I found online is listed below:

Private Sub btnaddappttooutlook_Click()
'On Error GoTo ErrHandle

Dim olNS As Object
Dim olApptFldr As Object

' Save the Current Record
If Me.Dirty Then Me.Dirty = False

[code]...

View 1 Replies View Related

Modules & VBA :: Insert Word File Into Outlook Email Within Access

Jul 8, 2013

I like to do following task using access VBA:

1. Open outlook.
2. Select word file(with tables and graphics) and insert into new outlook email.

View 1 Replies View Related

Modules & VBA :: Bring Outlook GAL Dialog To Front When Calling From Access

May 30, 2014

I've written a function which opens the Outlook GAL dialog, allows users to select recipients and passes back a 2-D array (recipients and type i.e. To, CC or BCC).Here is the code :

Code:
Public Function GetContactsFromOutlookGAL() As Variant
Dim appOutlook As Object ' Outlook Application
Dim objNameSpace As Object ' Outlook NameSpace
Dim objSelectNamesDialog As Object ' Outlook Select Names Dialog

[code]...

The only problem I have is that when I 'display' the SelectNamesDialog, it doesn't make it the active window and bring it to the front - it just opens the dialog in Outlook and you have to navigate to the main Outlook window to find it.I'd like for the dialog to 'popup' - ideally, without the main Outlook window dragging along behind

I believe it's possible (judging from this article) to achieve this using API's - specifically, a combination of FindWindow (to retrieve the window handle) and ShowWindowLong (to set it to a topmost window in front of all other windows).

View 12 Replies View Related

Modules & VBA :: Export Email Contact Address To Outlook Using Access 2003

Feb 3, 2015

I'm using an unbound text box and a command button to filter a list of contacts on a continuous form. The continuous form has a query for the record source and the list ends up showing only what is in the strWhere filter

Me.Filter = strWhere
Me.FilterOn = True

Is there a way to have Access 2003 take this filtered list and populate the To: field in Outlook or whatever the default mail client is? Each email needs to be deliminated by ";"

View 5 Replies View Related

Modules & VBA :: Auto Create Emails In Outlook Based On Data In Access?

Apr 20, 2015

I have a table called Contacts in Access:

ID Email
001 email1
002 email2
003 email3
004 email4
008 email5
010 email6

And I have a table called Data in Access:

ID Date Person Title Yes/No Action
001 20/4 Mr A Consultant
001 20/4 Mr B Supervisor
001 20/4 Mr C Consultant
004 20/4 Mr D Consultant
010 20/4 Mr E Consultant
010 20/4 Mr F Supervisor

What I'm looking for is coding that would start with the first ID number in CONTACTS and see if there is the corresponding ID in DATA. If there is, then I want it to create an Outlook email and have:

1.To field populated with the email address in the CONTACTS table

2.From and CC fields to be my email address

3.The subject line needs to read [ID] "Request" and then today's date backward (e.g. 20150420).

4.The body I need to put some generic wording and then a table with the records from the DATA table (first 5 fields plus the headings).

5. The format of the table etc isn't important as long as it is a table format

If it's created the email I want it to go back to the DATA table and put "Email Created" in the Action column for those IDs.

I don't want the email to automatically send; I only want it to create a draft (as this data needs to be manually confirmed before sending).

If for example it gets to checking in DATA table for ID 002 (and as seen there's none there), I want it to skip creating the email and move on to the next ID.

In the end I would expect to see 3 draft emails open in Outlook ready to be sent, looking something like the below (just 001 below)?

From... my email
To... Email1
CC... my email
Subject: 001 Request 20150420

action the below:

ID Date Person Title Yes/No
001 20/4 Mr A Consultant
001 20/4 Mr B Supervisor
001 20/4 Mr C Consultant

And the DATA table look like this (if only 001 email was created):

ID Date Person Title Yes/No Action
001 20/4 Mr A Consultant Email created
001 20/4 Mr B Supervisor Email created
001 20/4 Mr C Consultant Email created
004 20/4 Mr D Consultant
010 20/4 Mr E Consultant
010 20/4 Mr F Supervisor

I will need to add more data to the CONTACTS table over time, also the DATA table will be different each day so I need the coding to accomodate for both of these possibilities.

View 9 Replies View Related

Modules & VBA :: How To Run A Function From SQL Query In Access

Nov 26, 2013

I started using Access recently and I have an inquiry about VBA codes and sql queries. I have function which has the following signature: RAG(Stability as Integer, DS_SYNC_RATE as Integer, Profile as String) as String.

I would like to call this function in Insert sql query in order to calculate and add a new column to my table. I tried this basic query:

Insert INTO my_table VALUES (RAG(my_table.stability,my_table.ds_sync_rate, my_table.profile))

but it doesn't seem to work...

View 8 Replies View Related

Modules & VBA :: Possible To Call Windows Search Function Into Access?

Nov 3, 2014

I need a search function that will not just open files based on their names but also drill into the documents and search based on what's in it. The only way I can see now is to use the Window's search function (the one at the start button). Is it possible to call that function into access?how do I re-create the search style of the windows search bar for a specific folder? Something like streamreader

View 1 Replies View Related

Modules & VBA :: Creating A Function That Counts Records And Use That Function In A Query

Dec 11, 2013

So basically I need making a function that will count the number of records from another table/query based on a field from the current query.

View 2 Replies View Related

Modules & VBA :: Cannot Set Outlook Send Using Account

Jul 13, 2013

A client wants to e-mail newsletters using a non-default Outlook account. The code below does everything the client needs except setting the SendUsingAccount. In debug I can see that the correct account is assigned, yet all of my testing results in e-mails where the From line is the default account. The test setup uses my own isolated SMTP server, so when I look at the e-mails sent the sender is the default account. The default account's Sent folder shows the sent mail, which is not what we want.

Code:
Sub prepEmail()
Dim frm As Form, startDate As Date, endDate As Date
Dim rs As DAO.Recordset, strSQL As String, intNewsLetter As Integer
Dim rsEmail As DAO.Recordset, rsNewsletters As DAO.Recordset
Dim OlApp As Object, ol As Object
Dim olMail As Object, olAcct, olAcctTemp

[code]...

View 3 Replies View Related

Modules & VBA :: Saving Outlook Attachment

Jun 16, 2013

The below code is intended to:

1. open outlook mail;
2. copy the email details into the database;
3. save the attachment into a E: drive location;
4. move the email to another folder.

1,2 and 4 were working fine until I tries to save the attachment and got stuck on the SaveAs line.

Dim Ola As Outlook.Application
Dim Nsp As Outlook.NameSpace
Dim pf, Inbox, ib, newdest As Outlook.MAPIFolder
Dim msg As Outlook.MailItem
Dim Atts As Outlook.Attachments

[Code] ....

View 6 Replies View Related

Modules & VBA :: Email Subform Through Outlook

Jul 30, 2014

I'm trying to make it so when a subform is updated, it will email the contents of that subform to me. I've got it all working, except for the content of the email part.

Code:
Sub SendRepReassignment()
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim objOutlookAttach As Outlook.Attachment
On Error Resume Next
Err.Clear

[code]...

View 3 Replies View Related

Modules & VBA :: Outlook Move Item

Jun 27, 2014

Right I have the code in place but it will only work first time out look is opened, unless I have a msgbox on the first line and, I cant work out how to make it work with out it, obviously the msgbox isn't code doing any thing but it must be setting focus or some thing, here is the code

Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim objAtt As Outlook.Attachment
Dim objDestFolder As Object

[code]...

View 3 Replies View Related

Modules & VBA :: Email In Outlook With Attachments

Jun 16, 2013

I am making a new database. And I want to confirm that I can do all the following in Access 2007 and how is best to do it.

1) A form where I can define:a unique Email Number starting at 1.
a directory eg "C:UsersPaulDesktop101 - Brick House"
an email address.
a Recipient Name
a Category for the email. Choosing either "Working" or "Complete". This would be part of the email subject.

2) a button which onclick lists all the files in the defined directory to a box on the form.

3) a button which onclick exports a report containing the list of files to PDF. Then attaches a zip of these files and the PDF report to an email in Outlook for revision before sending.

4)In Outlook the subject would be:

"The Directory Name" - "The Category" - "The Email Number"
"101 - Brick House - Working - Email 1"

5)In Outlook the body would simply be the subject of the email followed by the filenames of the 2 attached files, ie the PDF report and the zip.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved