View Single Post
 
Old 02-27-2015, 06:35 PM
Lakeland Lakeland is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Feb 2015
Location: Canada
Posts: 2
Lakeland is on a distinguished road
Default How to use VBA to extract picasa photo captions and tags?

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.AddPicture( _
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:=wdCaptionPositionBelow
Selection.TypeParagraph
End If
Next

End Sub


The code can be found here:

http://www.vbaexpress.com/forum/arch...hp/t-6100.html

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

Thanks in advance!
Reply With Quote