tags:

views:

58

answers:

2

I'm writing a microsoft word macro and having difficulty with vb.net. Please help.

+1  A: 

A Word Macro is usually written in VBA rather than VB.Net, I'm assuming that you meant VBA?

Use the FileSystemObject to access the filesystem and then use recursion to "walk" down. Here's a sample:

http://www.java2s.com/Code/VBA-Excel-Access-Word/File-Path/RecursiveSearchusingtheFileSystemObjectModel.htm

If it's actually VB.Net you're using, the idea will be the same but use System.IO.Directory rather than the FileSystemObject.

ho1
It's VBA indeed. Thank you 'ho'.
Nam Gi VU
+1  A: 

Check out the answers here - VB6 is almost identical to VBA.

  • You will need to add a reference to the Microsoft Scripting Runtime if you want to use FileSystemObject
  • Or you can just drop in the CDirDrill class which means you won't need any external references.
MarkJ