Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Setting up protected document that can insert picture (photo ID template)
Hi I am unable to run this macro 100% correctly. It seems to work if I double click the macro button when the document is unprotected but when the document is protected, the macro no longer functions at all when double clicked. The cursor just jumps to the next text form field. Am I doing something wrong when applying this macro or when I am executing it? I copied and added you macro as it appears below. Public Sub ProtectedInsertPicture() Dim ilsPicture As InlineShape Dim strFileName As String Dim sngRatio As Single Const max_width = 216 ' = 3 inches (in points) ' temporarily unprotect ActiveDocument.Unprotect ' show Insert Picture dialog With Dialogs(wdDialogInsertPicture) If .Display = 0 Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, _ NoReset:=True Exit Sub End If strFileName = .Name End With ' remove macrobutton Selection.Delete Set ilsPicture = ActiveDocument.InlineShapes _ AddPicture( _ FileName:=strFileName, _ LinkToFile:=False, _ SaveWithDocument:=True, _ Range:=Selection.Range) ' limit size of picture to max_width (optional) With ilsPicture If .Width max_width Then sngRatio = CSng(max_width) / .Width Width = max_width Height = .Height * sngRatio End If End With ' reprotect, keeping form field contents intact ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _ NoReset:=True End Sub Regards Jason -- skylark_za |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how can i allow users to insert a picture in a protected form doc | Microsoft Word Help | |||
Need to insert a picture in a protected form (own choice of pic)? | Microsoft Word Help | |||
How do I insert photo into a Word template (protected document)? | Microsoft Word Help | |||
How can I insert a picture to a protected document and format it? | Microsoft Word Help | |||
How do i insert a photo into a protected form | Page Layout |