fiogf49gjkf0d Hi Alex,
I am happy to share with you, what I have at the moment. I have an excel form, that our users complete, then they press a button at the bottom of the form, once completed, that holds the following macro.
I spent a lot of time on this, and it has built in error checking for empty fields, and also saves a copy of the file you intend to email, to a specified location.
All this works really well, the only thing I have not successfully managed to do, is to add the attachment into Saleslogix. I'm not sure how good you are at debugging etc, but if you manage to find the 'tweek' that allows to send using Saleslogix rather than the standard Outlook Send, I would appreciate your feedback!
FYI : I did try various alterations of the final part of the macro, I believe the .Send needs to be something else, I tried the obvious .SendSLX etc, but couldn't get any joy with that. (I am, however, running Saleslogix 6.1 here).
Public Sub xyz()
Dim toAddress
toAddress = Range("c41").Value
If Range("d21").Value = "" Then
MsgBox "Error: 'Requested by' box is not completed."
End
Else
End If
MsgBox "Running: Sending to " & toAddress
Range("F21").Value = Now()
Filename = InputBox("Please Enter Customer Name and Reference")
ActiveWorkbook.SaveAs Filename:="\\IP of Server\and path\" & "RFQ_" & Filename ****This is for saving a copy of the file you are emailing to a folder****
'ThisWorkbook.SaveAs (Environ("userprofile") & Application.PathSeparator & "Desktop" & Application.PathSeparator & "RFQ_" & FileName)'
Dim myOutlook As Object
Dim myMailItem As Object
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
fname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With otlNewMail
.To = toAddress
.Subject = "RFQ " & Filename
.Body = "Please find attached RFQ" & Filename
.Attachments.Add fname
.Send
End With
Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
|