Results 1 to 15 of 15
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forwarding (2003 SP2)

    I frequently need to forward emails to my secretary, who is on the same network.
    There must be a more efficient way of doing it than pressing 'Forward' and entering her email address.
    If it was Access I could put a button on the Toolbar connected to the code to do this, but I have no idea how to do this in Outlook.
    Or maybe I can create a folder on the Folder view pane in Oulook that is connected to her email inbox, or automatically forwards email placed there to her address?
    Regards,
    Peter

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forwarding (2003 SP2)

    You could create the following macro iin a standard module in Outlook:

    Sub Forward2Secretary()
    Const strSecretary = "your secretary"
    Dim lngC As Long
    Dim strMsg As String

    On Error GoTo ErrHandler

    If TypeName(ActiveWindow) = "Inspector" Then
    If Not ActiveInspector.CurrentItem.Class = olMail Then
    strMsg = "This item is not an e-mail message."
    Else
    With ActiveInspector.CurrentItem.Forward
    .Recipients.Add strSecretary
    .Send
    End With
    End If
    ElseIf TypeName(ActiveWindow) = "Explorer" Then
    If ActiveExplorer.CurrentFolder.Items.Count > 0 Then
    If ActiveExplorer.Selection.Count > 0 Then
    For lngC = 1 To ActiveExplorer.Selection.Count
    If ActiveExplorer.Selection.Item(lngC).Class = olMail Then
    With ActiveExplorer.Selection.Item(lngC).Forward
    .Recipients.Add strSecretary
    .Send
    End With
    End If
    Next lngC
    Exit Sub
    Else
    strMsg = "You haven't selected any items."
    End If
    Else
    strMsg = "This folder doesn't contain any items."
    End If
    End If

    If Not strMsg = "" Then
    MsgBox strMsg, vbExclamation
    End If
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbExclamation
    End Sub

    You can assign this macro to a toolbar button in the toolbar in the main Outlook window and in the message window.

    Note: you'll get a security warning if you run this macro. You may want to install and run a program such as ClickYes..

  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forwarding (2003 SP2)

    Thanks for that Hans, it works beautifully. For some reason I thought that Outlook only had VB script not VBA. Which is silly as I have used the Outlook object model from within Access. But you sure saved me a whole heap of time.
    The button I inserted on the toolbar contains both an icon and text. I can change the icon picture, but I'm darned if I can get rid of the text. How do I get rid of the text? Also do you know how to put in the equivalent of Access's 'Control tip text', so that when the cursor hovers over the button some textual hint will show?
    Regards,
    Peter

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forwarding (2003 SP2)

    Select Tools | Customize...
    Right-click your custom toolbar button.
    Enter the 'control tip text' in the Name box and.
    Select ' Default Style' if you want only an icon, no text.
    Attached Images Attached Images
    • File Type: png x.png (100.9 KB, 0 views)

  5. #5
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forwarding (2003 SP2)

    You are truly amazing. The human database. Unless I write this down, it will have gone from memory in a week!
    Needless to say it all works wonderfully.
    Attached Images Attached Images
    Regards,
    Peter

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forwarding (2003 SP2)

    Whoops. It is now 1 day later and the VBA code has stopped working. If I try to run it from the Outlook Tools menu, the following dialog comes up:
    "The macros in this project are disabled. Please refer to online help ..... to detirmine how to enable macros."
    I didn't disable anything! the online help just says to install VBA from the original CD, but VBA is installed.
    Regards,
    Peter

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forwarding (2003 SP2)

    Check Tools | Macro | Security...
    If the security level is High, macros will be disabled automatically unless you have signed them with a digital certificate.
    You can set macro security to Medium, you should then be prompted to enable the macros.
    Or sign the macros. If you don't have an "official" digital certificate, you can use Selfcert.exe (in the Office11 folder) to create one for your personal use.

  8. #8
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forwarding (2003 SP2)

    I have created a self certificate and signed the macro. I have set security for macros to medium (I tried Low also).
    The button doesn't even call the macro!
    I re-created the button, but it still won't work. Hard to debug as there seems to be no way of seeing that the macro is currently assigned to the button.
    Regards,
    Peter

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Forwarding (2003 SP2)

    If you look at Hans graphic of the macro button options a few posts back, the last menu item is "Assign Macro" - you should be able to reattach the macro when you click that option. Also check that you attached the macro to a standard Module, not the ThisOutlookSession.
    -John ... I float in liquid gardens
    UTC -7ąDS

  10. #10
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forwarding (2003 SP2)

    Thanks John. On my Outlook there is no 'Assign Macro' option; instead I have 'Assign Hyperlink'. There appears no way of attaching a macro from this option.
    Regards,
    Peter

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Forwarding (2003 SP2)

    Can you attach the macro to a button starting from scratch?
    -John ... I float in liquid gardens
    UTC -7ąDS

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forwarding (2003 SP2)

    Sorry, the picture I posted was actually from Excel, not from Outlook. At the time, it didn't seem important since the picture illustrated what I wanted to show. I apologize for creating the wrong impression.

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forwarding (2003 SP2)

    As I noted to John, the "Assign Macro" item didn't belong in the screenshot - sorry about the confusion. You can either select Macros in the list of Categories in the Customize dialog, and drag a macro from the list of Commands to a toolbar, or set the OnAction property of a toolbar button to the name of a macro in code, for example:

    ActiveExplorer.CommandBars("Standard").Controls("A ttachment Manager").OnAction = "StartAttachmentManager"

    I have this working flawlessly for JohnBF's Attachment Manager add-in from <post:=443,421>post 443,421</post:>.

  14. #14
    5 Star Lounger
    Join Date
    May 2001
    Location
    Patterson Lakes, Melbourne, Victoria, Australia
    Posts
    637
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forwarding (2003 SP2)

    Now 9 months down the track and after a reinstal, I have lost all the code and am rebuilding this button. But I can't see how to access a 'Standard Module'. All that seems accessible is the module for 'ThisOutlookSession'
    Regards,
    Peter

  15. #15
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Forwarding (2003 SP2)

    Create one in the Visual Basic Editor by right-clicking the Project and Inserting a new Module.
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •