?
Solved

VBA ERROR 400

Posted on 2009-06-30
6
Medium Priority
?
1,781 Views
Last Modified: 2012-05-07
Hi, I created a macro to open all excel spreadsheets in a particular folder. However when I run the code, I get an error "Visual Basic 400"
Please can you tell me why?

Sub smiley_face()
'macro to open all files within a folder and apply password
 
strPassword = InputBox("Please enter your password")
 
sPath = "S:\Circulation\R Winters\"
 
sDir = Dir$(sPath & "*.xls", vbNormal)
 
Do Until LenB(sDir) = 0
Application.AskToUpdateLinks = False
Workbooks.Open Filename:=sPath & sDir, Password:=strPassword
sDir = Dir$
 
Loop
End Sub

Open in new window

0
Comment
Question by:tajinderpal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:r_johnston
ID: 24744037
0
 

Author Comment

by:tajinderpal
ID: 24744099
Sorry that did not help
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 24745015
Which line actually causes the error?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:tajinderpal
ID: 24761880
It does not tell me what line the error is as. Just a pop up box appears with the error code 400
0
 
LVL 23

Expert Comment

by:Kamaraj Subramanian
ID: 24761899
Excel Error 400 is a "catch-all" error for something that Excel cannot resolve in de-coding Macro lines. It is applied to Application Define Errors or Object Define Errors.

Like you have a Variable defined as a type of number, but the data you are loading into it is a string or object. Bang-Error: 400.
0
 
LVL 23

Accepted Solution

by:
Kamaraj Subramanian earned 1000 total points
ID: 24761918
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question