Sub mail()
'-----------------------------------------
'DECLARE AND SET VARIABLES
Dim otlApp As Object
Dim OtlNewMail As Object
Dim Signature As String
Set otlApp = CreateObject("Outlook.Application")
Set OtlNewMail = otlApp.CreateItem(olMailItem)
'-----------------------------------------
'GET DEFAULT EMAIL SIGNATURE
Signature = Environ("appdata") & "\Microsoft\Signatures\"
If Dir(Signature, vbDirectory) <> vbNullString Then
Signature = Signature & Dir$(Signature & "*.htm")
Else
Signature = ""
End If
Signature = CreateObject("Scripting.FileSystemObject").GetFile(Signature).OpenAsTextStream(1, -2).ReadAll
'-----------------------------------------
'CREATE EMAIL
'OtlNewMail.HTMLBody = Signature
With OtlNewMail
.To = "menopriezvisko@.firma.sk"
.CC = ""
.Subject = "dodatok do MOSu!"
.HTMLBody = "<HTML><BODY><P STYLE='font-family:Times New Roman;font-size:16'>Dobrý deň!<br>Prosím o nahodenie dodatku do MOSu!<br>Ďakujem. <br><br><br><br><br> " & Signature
.Display
'.Send
End With
'-----------------------------------------
'CLEANUP
Set OtlNewMail = Nothing
Set otlApp = Nothing
End Sub
Inak mali ste tam zle nadefinované premenné.
Ale neviem, čo s tým medzerami pred a za odsekmi, ako ich zrušiť...citovat