Troubleshooting Toolbar button problems

  • Thread starter Ianiv Eisenscher
  • Start date
I

Ianiv Eisenscher

I have created a custom form in Outlook 2003, and
published it to my oranizational forms directory. I then
modified and used to code provided here:

http://support.microsoft.com/?kbid=252426

I made the toolbar button and it works great until I
close Outlook. Then when I re-open Outlook the toolbar
button doesn't work, and even if I publish a new form and
follow the steps again the toolbar button won't work,
even though I can go choose the form.

I then tried the code found here:

http://www.outlookcode.com/d/launchform.htm

Which is basically the same. Both times it works the
first time, but never will again. Any suggestions would
be great.

Thanks,

Ianiv Eisenscher
Lehman, Bertram, & Wesley
 
S

Sue Mosher [MVP-Outlook]

Publishing the form has nothing to do with this, other than setting the
message class that your form launching macro presumably uses.

Does the macro run OK from the VBA project environment?
 
G

Guest

I apologize for my ignorance, but I'm not sure where you
mean by VBA Project environment. I took a standard mail
message form in form design mode in Outlook and changed
all the fields and then published the new form. Then I
followed the instructions on outlookcode.com to put the VB
script in under the visual basic editor, under Project1,
ThisOutlookSession.

I don't know if that means I need to put the VB script
somewhere other than ThisOutlookSession or not. This is
the code I put in.

Sub DisplayForm()
Set myFolder = Session.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items.Add("IPM.Note.phone")
myItem.Display
End Sub

Where phone is the name of my form when I published it.
I then added a button from the macro category under the
customize toolbar menu.

Do I need to put different code elsewhere?

Thanks for all your patience and help,

Ianiv Eisenscher
(e-mail address removed)
 
S

Sue Mosher [MVP-Outlook]

Your code is in the right place. Open the VBA environment by pressing
Alt+F11. Put the cursor inside the DisplayForm macro. Press F8. Do you see
the code execution highlight bar highlight the first statement inside your
macro? As you continue to press F8, does each line execute OK?

Also, I don't see where you're instantiating the Session object (which
should be a Namespace object. See if this code works better for you:

Sub DisplayForm()
Set objNS = Application.GetNamespace("MAPI")
Set myFolder = objNS.GetDefaultFolder(olFolderInbox)
Set myItem = myFolder.Items.Add("IPM.Note.phone")
myItem.Display
End Sub

Where did you publish the form?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
I

Ianiv Eisenscher

I placed your modified code in there, and then pressed
F8, it said that my macros were disabled for that
session. So I brought down the macro security to medium,
closed and re-opened outlook, and re-published the form
to the Inbox, and then it worked. But everytime I open
outlook it asks me if I want to enable macros, is there a
way that I can have this not ask every time, but not
change my macro security to low? Also will this code
work if I publish it to the Organizational Forms Library
(where I eventually want to put it)? Will I have to go
to each workstation and paste this code into the vbscript
area? Or is there a way that I can automate that process
too?

I'm getting so close to a solution now, I really
appreciate your time and help.

Thanks a lot,

Ianiv Eisenscher
(e-mail address removed)
 
S

Sue Mosher [MVP-Outlook]

See http://www.outlookcode.com/d/vb.htm#selfcert for information on using
the Selfcert.exe tool that comes with Office to digitally sign your VBA
macro project. Once it's signed, you can set macro security to High and not
be prompted.

Yes, this code will open a form published in the Organizational Forms
library. But you will have to give the code to each user to add to their VBA
project -- (NOTE: not VBScript). There is no way to automate that process.
Outlook VBA code is designed for your personal use; if you want an
organizational solution, consider a COM add-in.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
I

Ianiv Eisenscher

It works great now, thanks a lot for the help. I just
have one more question for future reference, if I want
another custom form, can I just add that code in again
with the other form's name and then make two buttons?

Anyway thanks a bunch for the help.

Ianiv Eisenscher
(e-mail address removed)
 

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