Welcome to the fracta.net forum!

Share your coding ideas or ask questions.

Question Re: Excel VBA list all files in a folder & subfolder

  • Visitor
  • Visitor
11 years 6 months ago - 6 months 1 week ago #129 by
sorry here is the document
Last edit: 6 months 1 week ago by roller.

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago - 11 years 6 months ago #130 by roller
Easy to sort out I think, try to make these changes. Go to the VBA editor and change this line:

For Each dp In wdapp.ActiveDocument.BuiltinDocumentProperties

to this:

For Each dp In wdapp.ActiveDocument.CustomDocumentProperties

and also change this line:

Set wd = wdapp.Documents.Open(d & "\" & fname)

to this:

Set wd = wdapp.Documents.Open(d & "\" & fname,,1)

The first change is self explanatory and the second should open the files as read only.

You also should uncomment the below line of code to close the files:

'wd.Close change to wd.Close, remove the '

I haven't tested this code, please try it. I don't know if there is a better way to do this, it won't be the fastest!
Last edit: 11 years 6 months ago by roller.

Please Log in or Create an account to join the conversation.

  • Visitor
  • Visitor
11 years 6 months ago #131 by
ooh we are nearly there my friend, it now closes the docs and has produced the custom properties, is there anyway to include them both custom and built in :)

Please Log in or Create an account to join the conversation.

  • Visitor
  • Visitor
11 years 6 months ago #132 by
right heading away on business now so will have to try and see if we can get this working for the charity a little later, will make a small donation now though for the work you have already done

Please Log in or Create an account to join the conversation.

  • Visitor
  • Visitor
11 years 6 months ago #133 by
Okay, made a donation

going with what we have thus far, if it can include the subject from "builtinDocuments" along with the custom information its is pulling across, i think we may have nailed this, very impressive by the way ;)

Please Log in or Create an account to join the conversation.

More
11 years 6 months ago #134 by roller
To get all properties, custom and standard just use both For Each statements, one after the other:

For Each dp In wdapp.ActiveDocument.BuiltinDocumentProperties
c = c + 1
Sheets(2).Cells(3, c).Formula = dp.Name
Sheets(2).Cells(r, c).Formula = dp.Value
Next

For Each dp In wdapp.ActiveDocument.CustomDocumentProperties
c = c + 1
Sheets(2).Cells(3, c).Formula = dp.Name
Sheets(2).Cells(r, c).Formula = dp.Value
next

Please Log in or Create an account to join the conversation.

Time to create page: 1.031 seconds
Powered by Kunena Forum