Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
skylark_za skylark_za is offline
external usenet poster
 
Posts: 1
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i allow users to insert a picture in a protected form doc Mac Microsoft Word Help 2 March 16th 07 06:07 PM
Need to insert a picture in a protected form (own choice of pic)? Alexandra Microsoft Word Help 0 April 6th 06 11:48 AM
How do I insert photo into a Word template (protected document)? Susie Q. Microsoft Word Help 0 March 4th 06 07:50 PM
How can I insert a picture to a protected document and format it? Nigel Microsoft Word Help 0 October 31st 05 08:17 PM
How do i insert a photo into a protected form Bammons Page Layout 1 April 24th 05 11:55 AM


All times are GMT +1. The time now is 07:36 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"