mass tagging with excel?

  • Thread starter Thread starter p2chang
  • Start date Start date
P

p2chang

hi

i was wondering if there was any way to mass tag excel files.
what i wanted to do was to add some info in each excel file i have by
going to file > properties > author

i was doing this manually with each file but it is taking way to long
so i was wondering if there was any other way to mass tag all of them
at the same time

thanks
 
You will have to have a looping macro to open each and use this idea

Workbooks("menu.xls").BuiltinDocumentProperties("Author").Value = "Don"
non tested but something like
for each wb in workbooks
Workbooks(wb &".xls").BuiltinDocumentProperties("Author").Value = "Don"
next wb
 
I'd stay away from the author property, but you could use any custom document
property you want:

Option Explicit
Sub testme01()

Dim myFileNames As Variant
Dim wkbk As Workbook
Dim fCtr As Long
Dim myCDP As DocumentProperties

myFileNames = Application.GetOpenFilename("Excel Files, *.xls", _
MultiSelect:=True)

If IsArray(myFileNames) = False Then
Exit Sub
End If

For fCtr = LBound(myFileNames) To UBound(myFileNames)
Set wkbk = Workbooks.Open(FileName:=myFileNames(fCtr))
Set myCDP = wkbk.CustomDocumentProperties

On Error Resume Next
myCDP("MyCustomDocPropertyName").Delete
On Error GoTo 0

myCDP.Add _
Name:="MyCustomDocPropertyName", _
Type:=msoPropertyTypeString, _
Value:="whateverIwanthere", _
LinkSource:=False, _
LinkToContent:=False

wkbk.Close savechanges:=True
Next fCtr

End Sub
 

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

Back
Top