Latest Code is better, uses Arrays to loop through the emails and add to an access recordset:
Public Sub GetEmailADO()
Dim conn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim objOL As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim ObjSubFolder As...
That's a real pain! But I've a feeling that you're right old chap.
I've not had any further success on it either.
Is it possible to download the contents of an enterprise address book to a local contacts folder so I can access it?
Hiya,
I'm saving emails from outlook to an Access DB using VBA. I'm trying to get the sender's email address from emails.
We're on IMAP here and the enterprise address book does not show up in Outlook. I tried using ADO/ADOX to connect to it like a table and it doesn't seem to want to play...
Hi Tran,
thanks for all your assistance man! I've gone with the autosize suggestion, the headers I'm leaving for now. Boy, I gotta learn how to use datagrids man!
Many thanks for all your help on this. A well deserved stars on it's way!
Q
I got there in the end! Thanks anyway!
Public Sub RipEmail()
Dim conn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim objOL As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim ObjSubFolder As Outlook.MAPIFolder
Dim myMailItem As Outlook.MailItem...
Also, another quick question:
How do I include column headings as well as autosize?
I'm aware of a .CoulumnHeads property, but this is a boolean and I can't see any other way of doing it. When I try to set RowSourceType property from the code I don't know what value to assign to it?
Hi Tranman,
Thanks for your assist, it works perfectly! I've modified to check for nulls.
rs.Open strSQL, con, adOpenDynamic, adLockOptimistic
UserForm6.DisplayBox.ColumnCount = rs.Fields.Count
Do While Not rs.EOF
UserForm6.DisplayBox.AddItem
For intCol = 0 To...
Hiya,
With VBA, I'm trying to retrieve messages from an IMAP folder in Outlook 98 (the sub runs from Excel 2002 though).
I can get the string name of the IMAP Root folder! Like this
Set objOL = New Outlook.Application
Set olNS = objOL.GetNamespace("MAPI")
Set objFolder = olNS.Folders.Item(1)
y...
Hiya,
I'll have a look at .RowSourceType = "Value List" later on 2day.
meanwhile, here's my spec:
Microsoft XP Professional 5.1.2600 Service Pack1 Build 2600
Microsoft Excel 2002 (10.4302.4219) Service Pack2
ListBox type is "Microsoft Forms 2.0 ListBox"
In the Data Section of Properties for...
Sorry, I just can't find it.
I can change this in the code though I guess:
With UserForm6.DisplayBox
.RowSourceType = whatever
End With
Can you tell me how to add the column headings? I know there is a value for rs.Fields(Col).Name, how do I assign that to the columns...
Hi,
I'm using VBA and not VB6. The "Row Source" option in the properties window for the ListBox accepts text but has no presets and nothing happens when I double click on it.
Setting the default column count is ok though.
Any suggestion what I'm doing wrong?
Tranman,
Thanks for getting back to me. I'm having some trouble implementing your suggestions.
It's a problem for me to have the right number of columns defined for the listbox, as the user can specify the SQL query that builds the recordset (therefore the number of colunms can change a lot)...
Hiya,
Using VBA, I'm trying to fill a list box with the contents of a recordset. I'm being a thick as it's putting each field from the rset into a new item on this list. How do you put each field into a new column ???
ReDim Arr(1 To rs.Fields.Count - 1)
ReDim Lbox(1 To...
Hiya,
no that doesn't work. I'm using this con string:
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mdb & _
";Persist Security info=False;Jet OLEDB:" & _
"System Database=system.mdw;" & _
"Password=pw;User ID=Admin"
But I get either workgroup information...
Hiya,
trying to connect to an access db that is password protected. I get a runtime error that says "Cannot start your application. The workgroup information file is missing or opened exclusively by another user"
The db in question is not open and the workgroup file is not missing, it's where...
Thanks Roy,
That's a massive help actually. I've implemented some of your suggestions and things are working , and quicker!
I appreciate the background info as well, it's a big help to me as I've no formal training at all. Much of the theory is new to me as I'm learning bit by bit, mainly...
That's exactly what I was after, thank you.
How can I Do the same but update 2 other recordsets (choosing which one to update depending on the value of the rectype field)?
I've adapted your code to delete in 1 of 2 tables. I now need to insert these records in 1 of 2 tables/recordsets, but I...
Hiya,
I'm trying to loop through every row in a recordset and if the field rectype = 2 then execute some SQL on another SEPERATE ADO connection that deletes all rows from a table.
For the row in the recordset that has the rectype of 2, I want to get the value of field "DistID" and use that in...
I have a feeling I've answered the 1st part of this question myself!
I just copied the Access type library from a machine where it was installed, registered it and the connection opens and the data comes through!
I'm not sure this is the correct way of doing it however, and I do get a...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.