Results 1 to 1 of 1

Thread: Opening file properties from a shortcut sent in Outlook

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    27

    Resolved Opening file properties from a shortcut sent in Outlook

    Hi, I have a code which opens properties of a file.
    I run these code from a command shell and it is working, but I want to run these code when I press a button on an Outlook form.
    I get the error: "424 Object Requiered"
    Here is a code after I've changed it a bit so that I call the sub after I press a button:
    VB Code:
    1. Sub OpenProperties_Click
    2.  
    3.     Const cnstSleepTime = 100000      ' display that long in milliseconds
    4.  
    5.     On Error Resume Next
    6.  
    7.     'sFilePath = wscript.Arguments.item(0)
    8.     sPath= "w:\Test\Test_Snir.doc"
    9.     'ShowProperties sFilePath
    10.  
    11.     'Sub ShowProperties(sPath)
    12.  
    13.     Set sh = CreateObject("shell.application")
    14.     sPathParts = Customsplit(sPath,"\")
    15.     Set ofso = CreateObject("Scripting.filesystemobject")
    16.     Set ofile = ofso.GetFile(sPath)
    17.     Set oShFolder = sh.NameSpace(ofile.ParentFolder.path)
    18.     Set oShfile = oshfolder.ParseName(spathparts(UBound(spathparts)))
    19.     If err.number <> 0 Then MsgBox "Error: " & err.number & vbCrLf & "Description: " & err.description
    20.     oshfile.invokeverb "P&roperties"
    21.     wscript.Sleep cnstSleepTime
    22.  
    23.     'End Sub
    24. End Sub
    25. '*********************************************************************************************
    26. '***** Function CustomSplit
    27. Function CustomSplit(sExpression, sDelimit)
    28.     Const cnstModulID = "CustomSplit"
    29.     Dim sArr, sCopyArr
    30.     Dim i, j
    31.  
    32.     On Error Resume Next
    33.  
    34.     If bDebug Then MsgBox cnstModulID & " invoked"
    35.  
    36.         If Len(sDelimit) = 1 and len(sExpression) > 0 Then        
    37.                 sArr = Split(sExpression,sDelimit)
    38.                 sCopyArr = Array()
    39.                 j = 0
    40.                 for i = 0 to UBound(sArr)
    41.                         if sArr(i) <> "" Then
    42.                                 ReDim Preserve sCopyArr(j)
    43.                                 sCopyArr(j) = sArr(i)
    44.                                 j = j +1
    45.                         end If
    46.                 Next
    47.                 CustomSplit = sCopyArr
    48.         Else
    49.                 CustomSplit = Array()
    50.         End If        
    51.        
    52. End Function
    53. '***** End Function CustomSplit
    54. '**********************************************************************************************

    hope someone can help
    Last edited by snir; Jun 22nd, 2005 at 05:10 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width