Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - Using Forms (http://www.outlookbanter.com/outlook-using-forms/)
-   -   Command Button (http://www.outlookbanter.com/outlook-using-forms/65283-command-button.html)

[email protected] January 17th 08 04:45 PM

Command Button
 
Hi, I want to write some code for a custom form. I want the user to
click a button and an address book pops up -- the same way an address
book pops up when the user clicks "To...", but I want it to display a
particular set of users/emails, for example "clients."

Is this possible to do with Outlook forms? Any help would be much
appreciated!

Jake

Sue Mosher [MVP-Outlook] January 17th 08 05:30 PM

Command Button
 
Depending on your Outlook version and configuration, it may be possible to display the Address Book dialog. However, to make it show a specific address list, you would need to use the third-party Redemption library; see http://www.dimastr.com/redemption/rd...ddressbook.htm

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
Hi, I want to write some code for a custom form. I want the user to
click a button and an address book pops up -- the same way an address
book pops up when the user clicks "To...", but I want it to display a
particular set of users/emails, for example "clients."

Is this possible to do with Outlook forms? Any help would be much
appreciated!

Jake


[email protected] January 17th 08 05:58 PM

Command Button
 
Hi Sue, I am getting an error that says "Property is read only" when I
try to execute the code. (It must be obvious I'm not a VB programmer
yet...trying to learn though...sorry if the code is completely off!)

Here is the code:

Sub CommandButton2_Click()

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.CC = "test1"
Msg.Recipients.ResolveAll
Msg.Subject = "test"
set AB = Session.AddressBook
set Recips = AB.ShowAddressBook(Msg.Recipients)
Msg.Recipients = Recips
Msg.Save

End Sub


On Jan 17, 11:30 am, "Sue Mosher [MVP-Outlook]"
wrote:
Depending on your Outlook version and configuration, it may be possible to display the Address Book dialog. However, to make it show a specific address list, you would need to use the third-party Redemption library; seehttp://www.dimastr.com/redemption/rdo/rdoaddressbook.htm

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54

wrote in ...
Hi, I want to write some code for a custom form. I want the user to
click a button and an address book pops up -- the same way an address
book pops up when the user clicks "To...", but I want it to display a
particular set of users/emails, for example "clients."


Is this possible to do with Outlook forms? Any help would be much
appreciated!


Jake



[email protected] January 17th 08 06:00 PM

Command Button
 
Also, by the way, I downloaded and installed the redemption package.

Sue Mosher [MVP-Outlook] January 17th 08 06:02 PM

Command Button
 
Which statement raises the error?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
Hi Sue, I am getting an error that says "Property is read only" when I
try to execute the code. (It must be obvious I'm not a VB programmer
yet...trying to learn though...sorry if the code is completely off!)

Here is the code:

Sub CommandButton2_Click()

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.CC = "test1"
Msg.Recipients.ResolveAll
Msg.Subject = "test"
set AB = Session.AddressBook
set Recips = AB.ShowAddressBook(Msg.Recipients)
Msg.Recipients = Recips
Msg.Save

End Sub


On Jan 17, 11:30 am, "Sue Mosher [MVP-Outlook]"
wrote:
Depending on your Outlook version and configuration, it may be possible to display the Address Book dialog. However, to make it show a specific address list, you would need to use the third-party Redemption library; see http://www.dimastr.com/redemption/rd...ddressbook.htm



wrote in ...
Hi, I want to write some code for a custom form. I want the user to
click a button and an address book pops up -- the same way an address
book pops up when the user clicks "To...", but I want it to display a
particular set of users/emails, for example "clients."


Is this possible to do with Outlook forms? Any help would be much
appreciated!


Jake



[email protected] January 17th 08 06:24 PM

Command Button
 
When I publish and then run the form, and click on the button, a popup
appears that says "Property is read-only".

I don't know how to debug the code to find out what statement is doing
it :(

On Jan 17, 12:02 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Which statement raises the error?


Sue Mosher [MVP-Outlook] January 17th 08 07:17 PM

Command Button
 
What version of Outlook, on what operating system?

In the meantime, you can add MsgBox statements between each pair of statements to get a sense for which execute before and after the error.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
When I publish and then run the form, and click on the button, a popup
appears that says "Property is read-only".

I don't know how to debug the code to find out what statement is doing
it :(

On Jan 17, 12:02 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Which statement raises the error?


wrote in message ...
Hi Sue, I am getting an error that says "Property is read only" when I
try to execute the code. (It must be obvious I'm not a VB programmer
yet...trying to learn though...sorry if the code is completely off!)

Here is the code:

Sub CommandButton2_Click()

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.CC = "test1"
Msg.Recipients.ResolveAll
Msg.Subject = "test"
set AB = Session.AddressBook
set Recips = AB.ShowAddressBook(Msg.Recipients)
Msg.Recipients = Recips
Msg.Save

End Sub


On Jan 17, 11:30 am, "Sue Mosher [MVP-Outlook]"
wrote:
Depending on your Outlook version and configuration, it may be possible to display the Address Book dialog. However, to make it show a specific address list, you would need to use the third-party Redemption library; see http://www.dimastr.com/redemption/rd...ddressbook.htm



wrote in ...
Hi, I want to write some code for a custom form. I want the user to
click a button and an address book pops up -- the same way an address
book pops up when the user clicks "To...", but I want it to display a
particular set of users/emails, for example "clients."


Is this possible to do with Outlook forms? Any help would be much
appreciated!



[email protected] January 17th 08 07:27 PM

Command Button
 
Outlook 2003, Windows XP.

Based on msgBox testing that you suggested, the problem occurs on the
first line:

set Session = CreateObject("Redemption.RDOSession")



On Jan 17, 1:17 pm, "Sue Mosher [MVP-Outlook]"
wrote:
What version of Outlook, on what operating system?

In the meantime, you can add MsgBox statements between each pair of statements to get a sense for which execute before and after the error.



Sue Mosher [MVP-Outlook] January 17th 08 08:44 PM

Command Button
 
Did you download and install the Redemption library?

The error message doesn't match the code statement. That statement is not setting any properties, read-only or otherwise.

This is a more likely problem statement:

Msg.Recipients = Recips

You cannot set a Recipients collection like that. Instead, you would need to loop through the Recips collection and, for each Recip.Address, call Msg.Recipients.Add to add that recipient to Msg.

To invoke the script debugger from Outlook 2003, open the item and choose Tools | Forms | Script Debugger. Choose New Instance of Microsoft Script Editor. Find your procedure and use the F9 key to place a breakpoint on the first line. When you click the button, code execution should stop at the breakpoint. You can then step through each statement by pressing the F11 key.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
Outlook 2003, Windows XP.

Based on msgBox testing that you suggested, the problem occurs on the
first line:

set Session = CreateObject("Redemption.RDOSession")



On Jan 17, 1:17 pm, "Sue Mosher [MVP-Outlook]"
wrote:
What version of Outlook, on what operating system?

In the meantime, you can add MsgBox statements between each pair of statements to get a sense for which execute before and after the error.


wrote in message ...
When I publish and then run the form, and click on the button, a popup
appears that says "Property is read-only".

I don't know how to debug the code to find out what statement is doing
it :(

On Jan 17, 12:02 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Which statement raises the error?


wrote in message ...
Hi Sue, I am getting an error that says "Property is read only" when I
try to execute the code. (It must be obvious I'm not a VB programmer
yet...trying to learn though...sorry if the code is completely off!)

Here is the code:

Sub CommandButton2_Click()

set Session = CreateObject("Redemption.RDOSession")
Session.Logon
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.CC = "test1"
Msg.Recipients.ResolveAll
Msg.Subject = "test"
set AB = Session.AddressBook
set Recips = AB.ShowAddressBook(Msg.Recipients)
Msg.Recipients = Recips
Msg.Save

End Sub


On Jan 17, 11:30 am, "Sue Mosher [MVP-Outlook]"
wrote:
Depending on your Outlook version and configuration, it may be possible to display the Address Book dialog. However, to make it show a specific address list, you would need to use the third-party Redemption library; see http://www.dimastr.com/redemption/rd...ddressbook.htm



wrote in ...
Hi, I want to write some code for a custom form. I want the user to
click a button and an address book pops up -- the same way an address
book pops up when the user clicks "To...", but I want it to display a
particular set of users/emails, for example "clients."


Is this possible to do with Outlook forms? Any help would be much
appreciated!



[email protected] January 18th 08 05:17 PM

Command Button
 
Hi Sue, thanks for the info. However, I noticed even if I delete all
the other lines of code except for the first line, I still get the
read only error. Could it have something to do with my write
privileges on my computer?

I installed redemption using the registry and everything installed
properly, so I don't think that is the issue.


Jake

On Jan 17, 2:44 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Did you download and install the Redemption library?

The error message doesn't match the code statement. That statement is not setting any properties, read-only or otherwise.

This is a more likely problem statement:

Msg.Recipients = Recips

You cannot set a Recipients collection like that. Instead, you would need to loop through the Recips collection and, for each Recip.Address, call Msg.Recipients.Add to add that recipient to Msg.

To invoke the script debugger from Outlook 2003, open the item and choose Tools | Forms | Script Debugger. Choose New Instance of Microsoft Script Editor. Find your procedure and use the F9 key to place a breakpoint on the first line. When you click the button, code execution should stop at the breakpoint. You can then step through each statement by pressing the F11 key.

--


Sue Mosher [MVP-Outlook] January 18th 08 06:25 PM

Command Button
 
Since you didn't include the text of the earlier posts, I don't know what statement is the first line.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
Hi Sue, thanks for the info. However, I noticed even if I delete all
the other lines of code except for the first line, I still get the
read only error. Could it have something to do with my write
privileges on my computer?

I installed redemption using the registry and everything installed
properly, so I don't think that is the issue.


Jake

On Jan 17, 2:44 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Did you download and install the Redemption library?

The error message doesn't match the code statement. That statement is not setting any properties, read-only or otherwise.

This is a more likely problem statement:

Msg.Recipients = Recips

You cannot set a Recipients collection like that. Instead, you would need to loop through the Recips collection and, for each Recip.Address, call Msg.Recipients.Add to add that recipient to Msg.

To invoke the script debugger from Outlook 2003, open the item and choose Tools | Forms | Script Debugger. Choose New Instance of Microsoft Script Editor. Find your procedure and use the F9 key to place a breakpoint on the first line. When you click the button, code execution should stop at the breakpoint. You can then step through each statement by pressing the F11 key.

--


[email protected] January 18th 08 06:35 PM

Command Button
 
Sorry, the line is:

set Session = CreateObject("Redemption.RDOSession")

But you also earlier wrote "The error message doesn't match the code
statement. That statement is not setting any properties, read-only or
otherwise," which leads me to believe the problem is with the way the
Redemption libraries are being accessed by my computer rather than the
line of code itself.

-Jake

On Jan 18, 12:25 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Since you didn't include the text of the earlier posts, I don't know what statement is the first line.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54

wrote in ...
Hi Sue, thanks for the info. However, I noticed even if I delete all
the other lines of code except for the first line, I still get the
read only error. Could it have something to do with my write
privileges on my computer?


I installed redemption using the registry and everything installed
properly, so I don't think that is the issue.


Jake


On Jan 17, 2:44 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Did you download and install the Redemption library?


The error message doesn't match the code statement. That statement is not setting any properties, read-only or otherwise.


This is a more likely problem statement:


Msg.Recipients = Recips


You cannot set a Recipients collection like that. Instead, you would need to loop through the Recips collection and, for each Recip.Address, call Msg.Recipients.Add to add that recipient to Msg.


To invoke the script debugger from Outlook 2003, open the item and choose Tools | Forms | Script Debugger. Choose New Instance of Microsoft Script Editor. Find your procedure and use the F9 key to place a breakpoint on the first line. When you click the button, code execution should stop at the breakpoint. You can then step through each statement by pressing the F11 key.


--



Sue Mosher [MVP-Outlook] January 18th 08 06:57 PM

Command Button
 
I've never heard of that warning message being associated with that statement. I have no further ideas. You could reinstall Redemption or drop a line to Redemption's developer.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


wrote in message ...
Sorry, the line is:

set Session = CreateObject("Redemption.RDOSession")

But you also earlier wrote "The error message doesn't match the code
statement. That statement is not setting any properties, read-only or
otherwise," which leads me to believe the problem is with the way the
Redemption libraries are being accessed by my computer rather than the
line of code itself.

-Jake

On Jan 18, 12:25 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Since you didn't include the text of the earlier posts, I don't know what statement is the first line.

wrote in ...
Hi Sue, thanks for the info. However, I noticed even if I delete all
the other lines of code except for the first line, I still get the
read only error. Could it have something to do with my write
privileges on my computer?


I installed redemption using the registry and everything installed
properly, so I don't think that is the issue.


Jake


On Jan 17, 2:44 pm, "Sue Mosher [MVP-Outlook]"
wrote:
Did you download and install the Redemption library?


The error message doesn't match the code statement. That statement is not setting any properties, read-only or otherwise.


This is a more likely problem statement:


Msg.Recipients = Recips


You cannot set a Recipients collection like that. Instead, you would need to loop through the Recips collection and, for each Recip.Address, call Msg.Recipients.Add to add that recipient to Msg.


To invoke the script debugger from Outlook 2003, open the item and choose Tools | Forms | Script Debugger. Choose New Instance of Microsoft Script Editor. Find your procedure and use the F9 key to place a breakpoint on the first line. When you click the button, code execution should stop at the breakpoint. You can then step through each statement by pressing the F11 key.


--




All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com