Hello,
I have a piece of code that automatically saves and sends a excel spreadsheet file (which is an empty spreadsheet send via email to people to fill in some details). However the code seems to work on some PCs and doesn't on others. A message comes up saying Microsoft Visual Baisc (a big red circle with a cross in it, then a number 400 in the middle of the message box). i don't know why it works sometimes and then it doesn't.
Does anyone know how to fix this problem?
Thank you in advance.
DitzySuz
Sub SaveandSend()
ThisFile = Range("C6").Value
ThisFile1 = Range("C5").Value
ThisFile2 = Range("C3").Value
ActiveWorkbook.SaveAs Filename:="Survey - " & ThisFile & ThisFile1 & ThisFile2
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = "lees6@anzn.com"
.Subject = "BM Survey"
.Attachments.Add ActiveWorkbook.FullName
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Configuration: Windows XP
Internet Explorer 6.0