Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Fri, 3 Oct 2008 09:09:01 -0700,    group: microsoft.public.word.tables        back       


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
date: Fri, 3 Oct 2008 09:09:01 -0700   author:   Lenny

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us