Unfortunately there is no way to "cleanly" bypass code in a form when it is
opened. In the UI you can get around this by holding down Shift when you
open the form.
What you can do is set a value in the field on the form before you call the
Display method, and check its value in the Item_Open event. If it is not
empty for example, you can exit the event and bypass any other code that
might fire. Note that setting field values will cause the PropertyChange and
CustomPropertyChange events to fire as well.
Otherwise, a better approach to providing access to a form while Offline is
to add the Public Folder to the user's Public Folders\Favorites folder. They
can access all of the items and custom forms published in that folder while
working in Offline mode (provided that Offline mode and Public Folder
Favorites access is enabled via the Advanced tab in the profile settings
pages for the Exchange profile).
BTW, there is a microsoft.public.outlook.program_forms newsgroup dedicated
to these topics.
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault/
"Sriram N A" wrote:
> I need to have a form which has been published to a public folder copied to
> the user's personal forms registry in script.
>
> I am trying to use an "Install" form published to a suitable public folder
> for this, so that the form definition of the form to be run is copied to the
> local registry, and can be taken offline.
>
> Code along the following lines will not do, because the Add method results
> in execution of code in the form being installed. Is there any way of
> programmatically replicating what is achieved in Outlook through Tools |
> Options | Other | Custom Forms | Manage Forms | Set | Copy?
>
> Set objItem = objFolder.Items.Add(strMsgClass) '<==Executes code in
> objItem
> Set objFormDescription = objItem.FormDescription
> objFormDescription.Name = "Indent"
> objFormDescription.PublishForm olPersonalRegistry
> objItem.Close olDiscard
>
> Sriram
>
>
>