vba - Outlook 2013 Userform with block Error when not "Popped Out" -


I have a set of macros that have worked out in Outlook 2003, 2007 and 2010. In fact, it still works in 2013 except for a special case.

Whenever you try to send an email - the macro key brings a dialogue box to tag the subject line with the word. The problem is, if I have just started Outlook, and I get a new email or answer - the default in Outlook 2013 is to bring it to the pre-reading pane instead of a new window. If I can not hit "pop out" and try to send me, then my macro crashes with this error:

"run-time error '91' object variable or block Variable is not set "

I first tried to check the loading of the form - but it seems like any call to my user, even userform.show generates this error is.

Strangely, if I remember my first "pop out" email, till I open Outlook / I open it again, everything goes fine even if I " Pop out "does not have other email It is only on the very first one which is this.

Here is the beginning of my initial event:

dim tag (string) as string dim In the form of slow-string string retarded nsourcefile as the recurrent integer slow email as the string dimension of the string in the form of the mailItem slow PD string as the demanding string 'set as email = application. Activate inspector Current Set Email = Application ActiveXplorer Selection. ITEM (1) 'A project number (it is not in the check list to see) may already be if email (email.Subject) & gt; 10000 then TagMsg.Height = long TagMsg.NewProjID = format (val (email.Subject), "00000") TagMsg.NewProjDesc.SetFocus otherwise the height of the set (the first "TagMsg.Height to hold more" button = short end

I've seen that set email email = Aplikeshn.aktivinspectorkkurntitm = Afelm set. Active Aksplorrksoclekshnkaitim (1). it is, however, VBA Do not make any assumptions regarding the "Return of the Item Method" method; Rkar should be able to manage the conversation header object. "

Note that the item is being brought by the items Sand event.

First of all, putting that code on an initialized event was not a good step. One click needs to be moved

< P>

the end result

  Dim oInspector Inspector from Slow Email as Explorer oInspector = Application.ActiveInspector set oexp = Application.ActiveExplorer so oInspector again as MailItem dim oexp 'email set = Application.ActiveExplorer.Selection.Item (1) Set up email = Email is nothing as oexp.ActiveInlineResponse We do not do anything then 'MsgBox "an active inspector or inline response" sub-end exit or set up email = oInspector.CurrentItem end if' oInspector checks to see nothing email.Sent then 'MsgBox Otherwise "this is not an editable email" 'If any project The set number (which is not in the list) can already be done if the email (email.Subject) & gt; 10000 then TagMsg.Height = long TagMsg.NewProjID = Format (val (email.Subject), "00000") TagMsg.NewProjDesc.SetFocus Else 'Set the form Height (formerly "more" button TagMsg.Height = less pressing end Note that this is still the fact that it is called the ItemSend event and is active or the current item depends on the email I just pressed. "Send" to. 

Thank you for your comment, retailcoder.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -