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 / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Check if macro running from email

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Will - 15 Jun 2007 02:28 GMT
How can visual basic determine that a macro is being run from within an email
(where Word is the editor) as opposed to being run from Word (not in outlook)?
Jonathan West - 15 Jun 2007 14:32 GMT
> How can visual basic determine that a macro is being run from within an
> email
> (where Word is the editor) as opposed to being run from Word (not in
> outlook)?

Check the HasRoutingSlip property of the document

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

Will - 15 Jun 2007 21:24 GMT
When I insert MsgBox ActiveDocument.HasRoutingSlip in the macro, it comes up
false in an email (using Word as the editor) and in a word document opened
from word.  I tried checking several other email properties, also to no
avail.  Any other ideas?  Thanks and blessings,   Will

> > How can visual basic determine that a macro is being run from within an
> > email
> > (where Word is the editor) as opposed to being run from Word (not in
> > outlook)?
>
> Check the HasRoutingSlip property of the document
Helmut Weber - 15 Jun 2007 23:06 GMT
Hi Will,

couldn't find an elegant, bullet proof answer,
but maybe this is sufficient:

Sub Test4d()
Dim oCmd As CommandBar
Dim bOut As Boolean ' outlook true/false
For Each oCmd In Application.CommandBars
  If oCmd.Visible = True Then
     If oCmd.Name = "Envelope" Then
        MsgBox "Outlook"
        Exit Sub
     End If
  End If
Next
MsgBox "Word"
End Sub

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Will - 16 Jun 2007 02:55 GMT
Bravo; as the English would say, Brilliant!!!  Thanks and blessings,   Will

> Hi Will,
>
[quoted text clipped - 14 lines]
> MsgBox "Word"
> End Sub
 
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.