Item_Open Question

C

Culverin

Hi:

Is there a way to tell programatically in the Item_Open Function whether a
form is being opened in design mode or run mode?

I have code in the Item_Open Function that will hide pages and show an error
page for user messages and actions if the logic detects that the version of
the user's form being opened is different from the current version.

The problem is that the Item_Open code executes whether the form is opened
in design or run time. I only want this part of the Item_Open code to
execute at run time. Is this possible?

Thanks for your help.
 
S

Sue Mosher [MVP-Outlook]

You can hold down the Shift key to prevent the form from running code when opening it in design mode.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Culverin

Thanks. Yes, that works. However, when I do that I now have two Calendar
controls and a List View control that shrink of their own volition. I've not
been able to figure out why these controls do that. Any ideas?

If there isn't a method or property to determine whether a form is opened in
design or run time I'll have to code a run-time error and use the Err code to
execute the Item_Open code I want to run conditionally. I know this is ugly,
but it'll work.

Thanks.
 
S

Sue Mosher [MVP-Outlook]

You can probably check by using CommandBars, since certain commands are visible and enabled in form design mode that shouldn't otherwise be available.

I generally avoid using any controls on forms that don't come with Outlook itself. You might have to include code to set those controls' UI properties.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
C

Culverin

Good idea about the CommandBars.

I have code to set the UI properties; which is why I need it to run in
design mode in the Item_Open but not the version check code.

Thanks a bunch.
 
C

Culverin

The "Form Design" bar is not visible at run time. I tried to use the visible
property of the object in the Item_Open function to determine whether the
form is opening in design or run time. It didn't work because the visible
property is still false when the Item_Open is executing. Similarly, the
Layout menu is not visible at run time. I tried using the Controls.Count
property as well but both design and run time counts were 9. I can only
conclude from this that the initial properties of the CommandBars are set
after the Item_Open executes.

When do these CommandBar changes occur? Obviously, the form knows it's
being opened in design mode and sets certain properties differently than at
run time. What executes after Item_Open and is it accessible
programatically? Alternatively, is there a property that can be referenced
in the Item_Open function that will allow me to tell the difference between
design and run?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top