View Single Post
  #1   Report Post  
Posted to microsoft.public.word.tables
Lenny Lenny is offline
external usenet poster
 
Posts: 74
Default Graphics inserted into a Word2003 table cell shrink!

Am working a Word2003 protected form template. Users want to be able to
insert a graphic representation of their signature into a 'signature' block
on the template. Each user will have a graphic file of their signature named
"MySignature" (for testing purposes it is a .jpg) to place in their "My
Documents" folder. When they click on a check box with an 'on entry' macro,
the code unlocks the form, goes to the signature cell bookmarked as
"Signature", opens the employees "My Documents" folder and selects and
inserts their signature, then relocks the file.

The code runs well, except the size of the inserted image changes (gets very
small). If I copy and paste the same image, or insert picture from file into
the same cell with the file unlocked, it copies in at the correct size. I
have checked the cells properties but cannot find a reason for the reduced
size of the graphic.... does anyone have any ideas? Help is really
appreciated. Regards - Lenny

See code below:

Dim objFSO As Object
Dim objShell As Object
Dim objFolder As Object
Dim objFolderItem As Object
Dim strPath As String

Const MY_DOCUMENTS = &H5&
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_DOCUMENTS)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path

ActiveDocument.Unprotect Password:="test"
Selection.GoTo What:=wdGoToBookmark, Name:="Signature"
Selection.Find.ClearFormatting
Selection.InlineShapes.AddPicture FileName:= _
strPath & "\MySignature.jpg", _
LinkToFile:=False, SaveWithDocument:=True
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True, Password:="test"
MsgBox "The document is locked."
End If
End Sub