Do you have Outlook installed? You should check that the CreateObject action
is successful before ploughing on.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Piotr" <hokah@wp.pl> wrote in message
news:1134992230.002838.136130@g43g2000cwa.googlegroups.com...
> Hi,
> I have this problem every time I try to code anything more complicated
> than few lines.
> It occurs for example in following code. Im sure the code is right as I
> use exactly same code on my second computer. This must be something in
> excel options or I have no clue ????
>
> Dim PathWinZip As String, FileNameZip As String, FileNameXls As
> String
> Dim ShellStr As String, strDate As String
> Dim OutApp As Object
> Dim OutMail As Object
>
>
>
> PathWinZip = "C:\program files\7-zip\"
> 'This will check if this is the path where WinZip is installed.
> If Dir(PathWinZip & "7z.exe") = "" Then
> MsgBox "Please find your copy of winzip32.exe and try again"
> Exit Sub
> End If
>
> ' Build the date/Time string
> strDate = Format(Now, "dd-mm-yy h-mm-ss")
> Set OutApp = CreateObject("Outlook.Application")
> Set OutMail = OutApp.CreateItem(0)
> <<<<<------------------------------error here
> With OutMail
>