PDA

View Full Version : How to use VBA to extract picasa photo captions and tags?



lakeland
02-27-2015, 02:23 PM
I wanted to insert photos in word document with word VBA using the codes below:


Sub BulkInsertPictures()

'!!! ADD A REFERENCE TO THE
'!!! Mircosoft Scripting Runtime
'!!! from Tools>References

Dim fso As FileSystemObject
Dim fldr As Folder
Dim f As File
Dim myNewPic As InlineShape
Dim scale_factor As Long

'set constants for max width of pictures
'and the path of the target folder
Const max_width As Long = 100
Const pic_path As String = "C:\TEMP"

Set fso = New FileSystemObject
'set up the target folder
Set fldr = fso.GetFolder(pic_path)

'loop through all the files in the target folder
For Each f In fldr.Files
'check file extension
If LCase(Right(f.Name, 3)) = "jpg" Then
'add picture
Set myNewPic = Selection.InlineShapes.
f.Path, False, True)
'check size and scale if too big
If myNewPic.Width > max_width Then
scale_factor = (max_width / myNewPic.Width) * 100
myNewPic.ScaleWidth = scale_factor
myNewPic.ScaleHeight = scale_factor
End If
Selection.TypeParagraph
Selection.InsertCaption Label:="Figure", TitleAutoText:="", _
Title:=": " & f.Name, Position:=
Selection.TypeParagraph
End If
Next

End Sub


The code is from 2005 posted by Killian. I don't have enough post counts to post a link. I can post the link later.


Is there any way to use VBA to extgract picasa photo captions and tags and put them in the word document?


Thanks in advance!

lakeland
02-27-2015, 02:24 PM
Killian is a user of this site.

lakeland
02-27-2015, 02:26 PM
archive/index.php/t-6100.html