Hi good day Everybody,

I've developed a small script for importing CSV files and automatically send them to a pre-defined email account. I've tested it on several windows PC's and it's working, but I cannot make it run on mac....

To be honest I'm newby with all this vba but I'm struggling to find any answer on the internet.

Thus, any help or guidance is much welcomed!!!

Please see below:

Sub Get_Data_From_File()
Dim sPath As String
Dim NewMail As CDO.Message
Dim mailConfiguration As CDO.Configuration
Dim fields As Variant
Dim msConfigURL As String


sPath = Application.GetOpenFilename(Title:="Browse for your file", FileFilter:="Excel Files (*.xls*; *.csv), *.xls*;*.csv")


Set NewMail = New CDO.Message
Set mailConfiguration = New CDO.Configuration
Set fields = mailConfiguration.fields

With NewMail
.Subject = "data file"
.From = "emailadress"
.To = "emailadress"
.Subject = sPath
.TextBody = "test"
.AddAttachment (sPath)


End With

msConfigURL = "configadress"

With fields
.Item(msConfigURL & "/smtpusessl") = True
.Item(msConfigURL & "/smtpauthenticate") = 1

.Item(msConfigURL & "/smtpserver") = "smtp.gmail.com"
.Item(msConfigURL & "/smtpserverport") = 465
.Item(msConfigURL & "/sendusing") = 2
.Item(msConfigURL & "/sendusername") = "emailadress"

.Item(msConfigURL & "/sendpassword") = "password"

.Update

End With

NewMail.Configuration = mailConfiguration
NewMail.Send

Workbooks.OpenText Filename:= _
sPath, DataType:=xlDelimited, Semicolon:=True, Local:=True


Set openbook = Application.Workbooks.Open(sPath)
openbook.Sheets(1).Range("A1:P30000").Copy
ThisWorkbook.Worksheets("Raw Data").Range("A1").PasteSpecial xlPasteValues
openbook.Close False



MsgBox "data successfully processed", vbInformation



End Sub



Thanks!!!!!!