Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with FileSearch in word VBA 2007 VBA

23 views
Skip to first unread message

jimoc

unread,
Sep 2, 2010, 1:15:58 PM9/2/10
to
Hello,

I have been using word 2003 with VBA code for macros and custom forms,
and everything was fine until I "upgraded" to office 2007 (full install).

Now, the following code errors on the Application.Filesearch line and when I mouse over it I see....

"With Application.Filesearch = <This command is not available on the current platform>"

I have the same references except that the Microsoft Word 11.0 Object Library and Microsoft Office 11.0 Object Library were changed to 12.0


With Application.Filesearch
.lookin = templatepath
.searchsubfolders = true
.filename = "*.dot"

.. and so on.

Thsi code populates a ListBox on a form with the template to choose for custom letters. It is a pain not to have it.

Any suggestions ?

Thank you ,
Jim

Greg Maxey

unread,
Sep 2, 2010, 10:12:05 PM9/2/10
to
See: http://support.microsoft.com/kb/920229

jimoc wrote:
> Hello,
>
> I have been using word 2003 with VBA code for macros and custom forms,
> and everything was fine until I "upgraded" to office 2007 (full
> install).
>
> Now, the following code errors on the Application.Filesearch line and
> when I mouse over it I see....
>
> "With Application.Filesearch = <This command is not available on the
> current platform>"
>
> I have the same references except that the Microsoft Word 11.0 Object
> Library and Microsoft Office 11.0 Object Library were changed to 12.0
>
>
> With Application.Filesearch

> lookin = templatepath
> searchsubfolders = true

jimoc

unread,
Sep 3, 2010, 9:33:09 AM9/3/10
to
Greg,
Thank you for the info.

Funny thing is, this is on a new Windows 7 system not XP. Maybe it was because I upgraded from 2003 to 2007.
I'll try the fixes mentioned in the article.

Again, my thanks

Jim

Graham Mayor

unread,
Sep 3, 2010, 9:49:48 AM9/3/10
to
The issue is not related to the operating system but to the vba provision in
Word 2007.
You could use something like

Dim strPath As String
Dim strFilename As String
Dim sList As String
strPath = "D:\My Documents\Test\"
sList = ""
strFilename = Dir$(strPath & "*.docx")
While Len(strFilename) <> 0
sList = sList & strFilename & vbCr
strFilename = Dir$()
Wend
MsgBox sList

instead

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"jimoc" <ji...@comcast.net> wrote in message
news:6t2dnUC_d8yIZB3R...@giganews.com...

0 new messages