Error message automating word 2007

N

Norm

Hi,

I am using Visual Basic and hope this is the right group to ask this in. I
have a program that automates MS Office and has worked fine up until Office
2007 and now I am getting the error message "This command not available on
this platform". Below is one of the commands that is giving me problems.

Set objwrd = CreateObject("Word.Application")'Works fine

Set fso = objwrd.FileSearch 'This line generates error

Is FileSearch not available in Office 2007 or do I need a different
reference for my program to work?

Any help appreciated.

Thanks,
Norm

--
Norm

Don't blame me, my programming is
self-taught and my teacher was not
very experienced. :)

normfowler_don't (e-mail address removed)
 
J

Jay Freedman

Hi Norm,

That's correct, FileSearch is not available in Office 2007. That function has
been handed over to the operating systems group and folded into Vista (turning a
blind eye to the millions of people who are still using XP if not older versions
of Windows).

Instead, try using the Dir function or the Scripting.FileSystemObject.

Although the article was written for Access,
http://support.microsoft.com/kb/935402 has links for learning about these
alternatives. You can also see sample code at
http://word.mvps.org/faqs/macrosvba/ReadFilesIntoArray.htm and
http://word.mvps.org/faqs/macrosvba/ReadFoldersIntoArray.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.
 
N

Norm

Jay said:
Hi Norm,

That's correct, FileSearch is not available in Office 2007. That
function has been handed over to the operating systems group and
folded into Vista (turning a blind eye to the millions of people who
are still using XP if not older versions of Windows).

Instead, try using the Dir function or the Scripting.FileSystemObject.

Although the article was written for Access,
http://support.microsoft.com/kb/935402 has links for learning about
these alternatives. You can also see sample code at
http://word.mvps.org/faqs/macrosvba/ReadFilesIntoArray.htm and
http://word.mvps.org/faqs/macrosvba/ReadFoldersIntoArray.htm.

Jay,

Thanks very much for the information. I really am not looking forward to
rewriting most of my application, but I guess that is what I will have to
do.

--
Norm

Don't blame me, my programming is
self-taught and my teacher was not
very experienced. :)

normfowler_don't (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top