Results 1 to 5 of 5
  1. #1
    2 Star Lounger rjbphillipsiii's Avatar
    Join Date
    Mar 2003
    Location
    Memphis, Tennessee, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro for Outlook (windows xp)

    10:32 AM 5/21/2008 - Wanted a macro to open a specific file from my outlook macro selection?
    The following is what I tried and it failed, any help from someone?

    Sub ComParts()
    Dim strCurrActvFolder As String

    strCurrActvFolder = CurDir ' stor current directory
    ChDir "C:My DocumentsRequisitions1 E-ScoutCOMSERV" ' change directory
    Application.Name "C:My DocumentsRequisitions1 E-ScoutCOMSERVREQ_COM1294.xls"
    'Shell "C:Program FilesINFORADWINPAGE.EXE" ' run program

    ' Tried to setup to change to Comserve in the Request form section
    ' Wanted to open a request form for parts & pricing ? the form is an .xls if this is any help
    ' The path information is correct and the folder information is correct.
    R.J.B. Phillips III
    Logical Systems Inc. Part Time Drafter
    IBC WONDER HOSTESS Retired 33+ years
    Firestone Tr & Rubber Company 15 Years rjbphillipsiii@yahoo.com

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

    Re: Macro for Outlook (windows xp)

    Put the following code at the top of a standard module:
    <code>
    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Public Const SW_SHOWNORMAL As Long = 1
    </code>

    You can use it in your macro as follows:
    <code>
    Sub ComParts()
    Const strFile = "C:My DocumentsRequisitions1 E-ScoutCOMSERVREQ_COM1294.xls"
    Dim lngResult As Long

    lngResult = ShellExecute(0&, "Open", strFile, 0&, 0&, SW_SHOWNORMAL)
    If lngResult <= 32 Then
    MsgBox "Couldn't open workbook", vbExclamation
    End If
    End Sub
    </code>
    Though why you would want to use a macro to open a specific workbook from Outlook escapes me.

  3. #3
    2 Star Lounger rjbphillipsiii's Avatar
    Join Date
    Mar 2003
    Location
    Memphis, Tennessee, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for Outlook (windows xp)

    I would be for temporary quick reference, used over and over for different vendor sheets. Sometimes when I get a call on a specific sheet that is pending, I then have to go to Excel, load a request form tracking sheet, find which month it was then use the hyperlink to open the file. This takes time so as needed I would change the reference and when some called in it would be a click away? This shed any light?
    R.J.B. Phillips III
    Logical Systems Inc. Part Time Drafter
    IBC WONDER HOSTESS Retired 33+ years
    Firestone Tr & Rubber Company 15 Years rjbphillipsiii@yahoo.com

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

    Re: Macro for Outlook (windows xp)

    Does the macro I posted do what you want? If not, I don't have a clue as to what you actually want.

  5. #5
    2 Star Lounger rjbphillipsiii's Avatar
    Join Date
    Mar 2003
    Location
    Memphis, Tennessee, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for Outlook (windows xp)

    Sub ComParts()
    Const strFile = "C:My DocumentsRequisitions1 E-ScoutCOMSERVREQ_COM1294.xls"
    Dim lngResult As Long

    lngResult = ShellExecute(0&, "Open", strFile, 0&, 0&, SW_SHOWNORMAL)
    ' If lngResult <= 32 Then
    ' MsgBox "Couldn't open workbook", vbExclamation
    ' End If
    End Sub
    I had to make a couple of lines into comments see above, but it was perfect. I opened the specific contact and there was the Icon which when I clicked it went stright to the .xls I needed the information from. Thank you so much for the assistance. Just a great time saver.
    R.J.B. Phillips III
    Logical Systems Inc. Part Time Drafter
    IBC WONDER HOSTESS Retired 33+ years
    Firestone Tr & Rubber Company 15 Years rjbphillipsiii@yahoo.com

Posting Permissions

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