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:
Sub OpenProperties_Click Const cnstSleepTime = 100000 ' display that long in milliseconds On Error Resume Next 'sFilePath = wscript.Arguments.item(0) sPath= "w:\Test\Test_Snir.doc" 'ShowProperties sFilePath 'Sub ShowProperties(sPath) Set sh = CreateObject("shell.application") sPathParts = Customsplit(sPath,"\") Set ofso = CreateObject("Scripting.filesystemobject") Set ofile = ofso.GetFile(sPath) Set oShFolder = sh.NameSpace(ofile.ParentFolder.path) Set oShfile = oshfolder.ParseName(spathparts(UBound(spathparts))) If err.number <> 0 Then MsgBox "Error: " & err.number & vbCrLf & "Description: " & err.description oshfile.invokeverb "P&roperties" wscript.Sleep cnstSleepTime 'End Sub End Sub '********************************************************************************************* '***** Function CustomSplit Function CustomSplit(sExpression, sDelimit) Const cnstModulID = "CustomSplit" Dim sArr, sCopyArr Dim i, j On Error Resume Next If bDebug Then MsgBox cnstModulID & " invoked" If Len(sDelimit) = 1 and len(sExpression) > 0 Then sArr = Split(sExpression,sDelimit) sCopyArr = Array() j = 0 for i = 0 to UBound(sArr) if sArr(i) <> "" Then ReDim Preserve sCopyArr(j) sCopyArr(j) = sArr(i) j = j +1 end If Next CustomSplit = sCopyArr Else CustomSplit = Array() End If End Function '***** End Function CustomSplit '**********************************************************************************************
hope someone can help![]()


Reply With Quote