我需要对元数据进行批量修改,因为我父亲想放置一个 "title"
总共 .jpg
文件夹中的图像。
我告诉他查看照片并在Excel电子表格中写下要按顺序写下的信息。一格一档。
所以我创建了循环来读取电子表格,但我不知道我需要与 .jpg
一起使用哪些文件对象。文件以及哪些方法可以读取或写入元数据标签。
MSDN 对此没有提供任何帮助。
一点代码
Sub seleccionaYmuesrtra()
'in the first column there are the file names.
'in the second column there are the titles written manually
Dim image As ????
???? Set image = New Bitmap("c:\FakePhoto.jpg")
Cells(1, 1).Activate 'I start in the first cell.
Dim contenido, ruta, nombre As String 'some variables
ruta = "C:\imagesToUseinFolder"
While (Not IsEmpty(ActiveCell)) 'this goes down in the first column until the first empty cell.
nombre = ruta & ActiveCell.Value & ".jpg"
contenido = ActiveCell.Offset(1, 0).Value
'------------------------------------
'HERE GOES THE ACTION I DON'T KNOW
...
'------------------------------------
ActiveCell.Offset(1, 0).Activate 'MOVE ONE DOWN
Wend
End Sub
我正在使用带有 windows7 的笔记本电脑工作,但我认为它应该可以在带有 XP 的 parent 台式电脑上工作。
谢谢你的时间,我希望这还没有回答。
最佳答案
您可以尝试将工具作为命令行命令调用(如果需要帮助调用,请参阅 Execute a command in command prompt using excel VBA )
Exiftool 是一个很好的免费独立可执行文件,应该可以满足您的需求:
http://www.sno.phy.queensu.ca/~phil/exiftool/
关于excel - 如何使用 VBA 修改 JPG 文件中的元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25414046/