Search : in
By :

Error Message Visual Basic 400 - help!

Last answer on Oct 5, 2009 2:55:40 pm BST DitzySuz, on Mar 24, 2009 12:13:41 am GMT 
 Report this message to moderators

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

Best answers for « Error Message Visual Basic 400 help! » in :
System error: Microsoft Visual Basic Show System error: Microsoft Visual Basic When opening Excel, you encounter the following error message. A window called "Microsoft Visual Basic" opens with the following contents: System Error & H80004005 (-2147467259). Unspecified error...
Error Message: You need permission to perform this action ShowError Message: You need permission to perform this action Accessing file Re-assign access rights When trying to delete a file or folder, following error message appears: You need permission to perform this action You've...
Epson Error Message [End of Service Life] ShowEpson Error Message [End of Service Life] Download and install SCC Service Utility If your Epson printer has been displaying the error message End of Service Life, hold it before planning to buy a new one. The problem does not come...
Error message: UNMOUNTABLE_BOOT_VOLUME ShowError message: UNMOUNTABLE_BOOT_VOLUME Intro Solution Intro This message does not necessarily mean that the hard disk is defective, it may be simply a problem in the boot sequence of the disc. When booting up to Windows XP, you are...
Download Windows Error Message Creator ShowThe chains which alert on viruses do not work any more, then made more extremely. If you want to scare your colleagues or your friends on their computer, the best means is of their envoy a message of error. Windows Error Message Creator is a very...

1

sensei.moore, on Mar 24, 2009 8:07:33 am GMT

Looks good to me :( don't see any errors in here...

Reply to sensei.moore

2

DitzySuz, on Mar 25, 2009 8:03:50 am GMT
  • +2

Hi

Thanks for checking this for me. I run debug on a PC where the code would not work and it stopped at AciveWorkbook SaveAs FileName = "Survey - " & ThisFile1 & ThisFile2 & This File3, with a message saying "Application-defined or Object-defined error 1004". Do you think it could be because the Filename is too long for an older Excel version? (I noticed the code had worked on Excel 2003 but not Excel 2000).

Thanks for your help.
DitzySuz

Reply to DitzySuz

3

 spyderman, on Oct 5, 2009 2:55:40 pm BST

I was getting the same message and ended up tracing it back that I has some cell protected in the range. I un-proteced the cells and things are great once again.

Might be worth a try.

Reply to spyderman