Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / June 2004

Tip: Looking for answers? Try searching our database.

Debugging environment code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bryan Dickerson - 25 Jun 2004 20:37 GMT
Is there some code that I can put in my Custom Form VBScript to tell that
I'm in the development environment?  So that I don't execute code that is
meant only for the production environment?  Something like "If Debug <> True
Then"???

TIA!
Bryan Dickerson - 28 Jun 2004 21:12 GMT
Bueller? Bueller?  Anyone? Anyone?

> Is there some code that I can put in my Custom Form VBScript to tell that
> I'm in the development environment?  So that I don't execute code that is
> meant only for the production environment?  Something like "If Debug <> True
> Then"???
>
> TIA!
Sue Mosher [MVP-Outlook] - 28 Jun 2004 21:32 GMT
See answer posted to a similar question last week at
http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public
.outlook.program_forms&mid=fbb81ee8-0641-43d8-a1a5-05c0a214d246


Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Is there some code that I can put in my Custom Form VBScript to tell that
> I'm in the development environment?  So that I don't execute code that is
> meant only for the production environment?  Something like "If Debug <> True
> Then"???
>
> TIA!
Bryan Dickerson - 28 Jun 2004 22:43 GMT
I read your response and didn't quite understand it, but I went ahead and
tried what I thought you meant by checking for the "Forms" menu item.

MsgBox "Item.GetInspector.CommandBars.ActiveMenuBar.FindControl(,
30145).Visible is " & _

   Item.GetInspector.CommandBars.ActiveMenuBar.FindControl(, 30145).Visible

I put this in the Item_Open Event and it returns false either way.  What am
I doing wrong?

> See answer posted to a similar question last week at

http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public
.outlook.program_forms&mid=fbb81ee8-0641-43d8-a1a5-05c0a214d246


> > Is there some code that I can put in my Custom Form VBScript to tell that
> > I'm in the development environment?  So that I don't execute code that is
[quoted text clipped - 3 lines]
> >
> > TIA!
Sue Mosher [MVP-Outlook] - 28 Jun 2004 23:22 GMT
You're using not the parent CommandBars, but a child menu. Try it this way:

   Set objInsp = Item.GetInspector
   Set colCB = objInsp.CommandBars
   Set objCBB = colCB.FindControl(, 30145)
   If Not objCBB Is Nothing Then
       MsgBox "CommandBar ID 30145 Is visible (T/F): " & objCBB.Visible
   End If
   Set objCBB = nothing
   Set colCB = Nothing
   Set objInsp = Nothing

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> I read your response and didn't quite understand it, but I went ahead and
> tried what I thought you meant by checking for the "Forms" menu item.
[quoted text clipped - 8 lines]
>
> > See answer posted to a similar question last week at

http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public
.outlook.program_forms&mid=fbb81ee8-0641-43d8-a1a5-05c0a214d246


> > > Is there some code that I can put in my Custom Form VBScript to tell
> that
[quoted text clipped - 5 lines]
> > >
> > > TIA!
Bryan Dickerson - 29 Jun 2004 19:43 GMT
It still says "False" both ways.  I guess I'm still doing something wrong.
Hmmm...   Could it be that I have it in the Item_Open event which actually
runs before anything is displayed?  If so, then is there anything else?  My
dilemma is that I have a database insert in the Item_Open that I would
really not like to happen if I'm working on the form, but if I'm opening up
the form for testing or if a user is opening the form then it's ok.  I get
tired of going back and deleting all the records that got inserted just
because I was editing the form.

> You're using not the parent CommandBars, but a child menu. Try it this way:
>
[quoted text clipped - 22 lines]
> >
> > > See answer posted to a similar question last week at

http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public
.outlook.program_forms&mid=fbb81ee8-0641-43d8-a1a5-05c0a214d246


> > > > Is there some code that I can put in my Custom Form VBScript to tell
> > that
[quoted text clipped - 6 lines]
> > > >
> > > > TIA!
Sue Mosher [MVP-Outlook] - 29 Jun 2004 21:44 GMT
Ah, you're using this code in the Item_Open event! I think you're correct
that Item_Open fires *before* the item switches into design mode and that,
therefore, there's no way to use that event to determine what state the item
is in.

Why are you doing a database insert in Item_Open? Wouldn't that create a lot
of extraneous items when the user opens and item and then discards it?

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> It still says "False" both ways.  I guess I'm still doing something wrong.
> Hmmm...   Could it be that I have it in the Item_Open event which actually
[quoted text clipped - 4 lines]
> tired of going back and deleting all the records that got inserted just
> because I was editing the form.
Bryan Dickerson - 29 Jun 2004 22:18 GMT
True.  I guess I was so enamored with the way the ODBC stuff was being
inserted and running so well that I lost track of the program flow.  It
would make more sense to wait until the user hits the "Save" button to do
the insert.

Thanks for the perspective, too!

> Ah, you're using this code in the Item_Open event! I think you're correct
> that Item_Open fires *before* the item switches into design mode and that,
[quoted text clipped - 14 lines]
> > tired of going back and deleting all the records that got inserted just
> > because I was editing the form.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.