- Thank you received: 9
Welcome to the fracta.net forum!
Share your coding ideas or ask questions.
Share your coding ideas or ask questions.
Question Re: Excel VBA list all files in a folder & subfolder
- Visitor
11 years 6 months ago - 6 months 1 week ago #129
by
Replied by on topic Re: Excel VBA list all files in a folder & subfolder
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.
11 years 6 months ago - 11 years 6 months ago #130
by roller
Replied by roller on topic Re: Excel VBA list all files in a folder & subfolder
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!
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
11 years 6 months ago #131
by
Replied by on topic Re: Excel VBA list all files in a folder & subfolder
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
11 years 6 months ago #132
by
Replied by on topic Re: Excel VBA list all files in a folder & subfolder
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
11 years 6 months ago #133
by
Replied by on topic Re: Excel VBA list all files in a folder & subfolder
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
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.
11 years 6 months ago #134
by roller
Replied by roller on topic Re: Excel VBA list all files in a folder & subfolder
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
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