![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Sue,
Am trying to adapt your Listing 24.4 to my needs to make objContact entries into what is selected as Current Folder. Program runs and works but all objContact entries show up in the default Contacts folder rather than the selected current folder. With Watches set during Debut I can see that the Current Folder is getting selected OK, and the code is creating objContacts...just not in the current folder. Can you take a look at this partila listng of the code and tell me what is wrong. The Watch on objCurrentFolder in line 5 shows for sure it is at the current folder I want the objContacts to go to, but they go into the default Contacts folder instead: Set objWB = objExcel.Workbooks.Add("C:\ExcelDL.xls") Set objWS = objWB.Worksheets(1) Set objRange = objWS.Range("test") Set objApp = CreateObject("Outlook.Application") Set objCurrentFolder = objApp.ActiveExplorer.CurrentFolder If Not objCurrentFolder Is Nothing Then intRowCount = objRange.Rows.Count If intRowCount 0 Then For I = 1 To intRowCount Set objContact = objApp.CreateItem(olContactItem) With objContact .FullName = objRange.Cells(I, 1) .Email1AddressType = objRange.Cells(I, 3) .Email1Address = objRange.Cells(I, 2) .Save End With Next End If End If -- John E. |
#2
|
|||
|
|||
![]()
CreateItem always puts items in the default folder. Use objCurrentFolder.Items.Add instead.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "John E." wrote in message ... Sue, Am trying to adapt your Listing 24.4 to my needs to make objContact entries into what is selected as Current Folder. Program runs and works but all objContact entries show up in the default Contacts folder rather than the selected current folder. With Watches set during Debut I can see that the Current Folder is getting selected OK, and the code is creating objContacts...just not in the current folder. Can you take a look at this partila listng of the code and tell me what is wrong. The Watch on objCurrentFolder in line 5 shows for sure it is at the current folder I want the objContacts to go to, but they go into the default Contacts folder instead: Set objWB = objExcel.Workbooks.Add("C:\ExcelDL.xls") Set objWS = objWB.Worksheets(1) Set objRange = objWS.Range("test") Set objApp = CreateObject("Outlook.Application") Set objCurrentFolder = objApp.ActiveExplorer.CurrentFolder If Not objCurrentFolder Is Nothing Then intRowCount = objRange.Rows.Count If intRowCount 0 Then For I = 1 To intRowCount Set objContact = objApp.CreateItem(olContactItem) With objContact .FullName = objRange.Cells(I, 1) .Email1AddressType = objRange.Cells(I, 3) .Email1Address = objRange.Cells(I, 2) .Save End With Next End If End If -- John E. |
#3
|
|||
|
|||
![]()
Sue,
Was just coming back to post another message to tell you I had already found the answer to my previous posting on page 262 of your book, when I got your posting notification at the same time. Should have looked harder in your book....but I'm learning a lot from your book and should be less of a pest as time continues. Bear with me. I think I am a testimony to your book that it can teach a almost non-experienced programmer (Fotran, Basic, and Pascal were my last experience years ago) how to work in VBA ;) BTW, one help would be a CD-ROM with electronic .pdf version of your book provided with the book so searches could be done electronically....that is the case with Jim Boyce's book and it is extremely helpful. Recognize that Amazon gave me access to online search of your manuscript, but it is slow and the user interface is a pain. Maybe something to consider if your publisher would go for it in your next edition or next book. -- John E. "Sue Mosher [MVP-Outlook]" wrote: CreateItem always puts items in the default folder. Use objCurrentFolder.Items.Add instead. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "John E." wrote in message ... Sue, Am trying to adapt your Listing 24.4 to my needs to make objContact entries into what is selected as Current Folder. Program runs and works but all objContact entries show up in the default Contacts folder rather than the selected current folder. With Watches set during Debut I can see that the Current Folder is getting selected OK, and the code is creating objContacts...just not in the current folder. Can you take a look at this partila listng of the code and tell me what is wrong. The Watch on objCurrentFolder in line 5 shows for sure it is at the current folder I want the objContacts to go to, but they go into the default Contacts folder instead: Set objWB = objExcel.Workbooks.Add("C:\ExcelDL.xls") Set objWS = objWB.Worksheets(1) Set objRange = objWS.Range("test") Set objApp = CreateObject("Outlook.Application") Set objCurrentFolder = objApp.ActiveExplorer.CurrentFolder If Not objCurrentFolder Is Nothing Then intRowCount = objRange.Rows.Count If intRowCount 0 Then For I = 1 To intRowCount Set objContact = objApp.CreateItem(olContactItem) With objContact .FullName = objRange.Cells(I, 1) .Email1AddressType = objRange.Cells(I, 3) .Email1Address = objRange.Cells(I, 2) .Save End With Next End If End If -- John E. |
#4
|
|||
|
|||
![]()
Thanks for the suggestion. I'll pass it along, but I've never seen Digital Press package a CD with any of the books in this series.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "John E." wrote in message ... Sue, Was just coming back to post another message to tell you I had already found the answer to my previous posting on page 262 of your book, when I got your posting notification at the same time. Should have looked harder in your book....but I'm learning a lot from your book and should be less of a pest as time continues. Bear with me. I think I am a testimony to your book that it can teach a almost non-experienced programmer (Fotran, Basic, and Pascal were my last experience years ago) how to work in VBA ;) BTW, one help would be a CD-ROM with electronic .pdf version of your book provided with the book so searches could be done electronically....that is the case with Jim Boyce's book and it is extremely helpful. Recognize that Amazon gave me access to online search of your manuscript, but it is slow and the user interface is a pain. Maybe something to consider if your publisher would go for it in your next edition or next book. -- John E. "Sue Mosher [MVP-Outlook]" wrote: CreateItem always puts items in the default folder. Use objCurrentFolder.Items.Add instead. "John E." wrote in message ... Sue, Am trying to adapt your Listing 24.4 to my needs to make objContact entries into what is selected as Current Folder. Program runs and works but all objContact entries show up in the default Contacts folder rather than the selected current folder. With Watches set during Debut I can see that the Current Folder is getting selected OK, and the code is creating objContacts...just not in the current folder. Can you take a look at this partila listng of the code and tell me what is wrong. The Watch on objCurrentFolder in line 5 shows for sure it is at the current folder I want the objContacts to go to, but they go into the default Contacts folder instead: Set objWB = objExcel.Workbooks.Add("C:\ExcelDL.xls") Set objWS = objWB.Worksheets(1) Set objRange = objWS.Range("test") Set objApp = CreateObject("Outlook.Application") Set objCurrentFolder = objApp.ActiveExplorer.CurrentFolder If Not objCurrentFolder Is Nothing Then intRowCount = objRange.Rows.Count If intRowCount 0 Then For I = 1 To intRowCount Set objContact = objApp.CreateItem(olContactItem) With objContact .FullName = objRange.Cells(I, 1) .Email1AddressType = objRange.Cells(I, 3) .Email1Address = objRange.Cells(I, 2) .Save End With Next End If End If -- John E. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
put all email addresses sent in a special contact folder | Maria Marsala | Outlook - Using Contacts | 3 | August 3rd 06 12:30 PM |
How do I put Outlook in startup folder and start minimized like 20 | millerj | Outlook - General Queries | 3 | May 30th 06 03:16 AM |
VBA Code to put in Access that will send an Email with Attachments | [email protected] | Outlook and VBA | 1 | April 9th 06 05:30 PM |
Using VBA code to move current message to a folder | Dean | Outlook and VBA | 4 | February 26th 06 01:46 AM |
REplies not sent out but put in same sub folder | Kristan | Outlook - General Queries | 4 | January 12th 06 03:40 PM |