Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba

ResolvedVersion 2010

Charlotte has attended:
Excel Advanced course

VBA 2003 to 2010

Hi, I have a macro which was written in Excel 2003. The macro is designed to pick up .xml files in a location selected by the user, and collates the information into one file with column headers (the files selected are in the same format).

When run in Excel 2010 the message "Run-time error '445': Object doesn't support this action" is displayed. After speaking to my course instructor on Friday he advised me to click on Debug and the text causing the issue would be displayed.

The debugger highlights " With Application.FileSearch" which after looking up it seems is no longer supported.

This is the full text:

With Application.FileSearch
.NewSearch
.SearchSubFolders = False
.LookIn = FolderChoice
.FileType = msoFileTypeAllFiles
.Execute

Can you advise me on how I can fix this?

thanks

RE: VBA 2003 to 2010

Hi Charlotte,

Thank you for the forum question.

Microsoft has removed the option in VBA to use Application.FileSearch. To replace the FileSearch function you can write your own function or use the Dir() function together with a decision code (If Then Else or Select Case).

https://www.youtube.com/watch?v=_RbwetdGQkE

I have found a couple of links where you can see some examples.

http://www.mrexcel.com/forum/excel-questions/643288-excel-2010-visual-basic-applications-replacement-application-filesearch.html

https://social.msdn.microsoft.com/Forums/en-US/a450830d-4fc3-4f4e-aee2-03f7994369d6/applicationfilesearch-in-excel-2007?forum=isvvba

https://social.technet.microsoft.com/Forums/en-US/541a4f9d-1f08-4afd-a079-d175c3512b9f/excel-2007-vba-filesearch?forum=excel

http://vbadud.blogspot.co.uk/2010/02/office-2010-applicationfilesearch-error.html



I hope this can help you.




Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Tue 6 Oct 2015: Automatically marked as resolved.

Excel tip:

Some examples of CTRL key shortcuts in Excel 2010

Did you know that the old CTRL key shortcuts haven't changed from previous versions of Excel to the 2010 version?

They remain exactly the same:

Ctrl+B for bold
Ctrl+I for italics
Ctrl+P to Print
Ctrl+S to Save

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.