Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / March 2005

Tip: Looking for answers? Try searching our database.

How do I create a macro to data sort in a table within a protecte.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keenly52 - 28 Mar 2005 16:03 GMT
I'm creating a user form in Word that includes a table to be sorted afterthe
user enters their info - specifically a sort on the "date" column.

The macro I created works fine in an unprotected doc, but not when it's
protected - which it will always be when being used by others.

I can't find a Word command to include in the macro unprotect the doc or the
selection ('ProtectedForForms = False' doesn't work in Word) ... I can't
create a macro in a protected document (I don't think), and when clicking on
"Protect Document" the macro stops recording.

Any help with a solution is greatly appreciated. Thanks.
Graham Mayor - 28 Mar 2005 17:02 GMT
Try the following

'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
 bProtected = True
 ActiveDocument.Unprotect
End If

Put your code here

'Reprotect the document.
If bProtected = True Then
 ActiveDocument.Protect _
 Type:=wdAllowOnlyFormFields, NoReset:=True
End If

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I'm creating a user form in Word that includes a table to be sorted
> afterthe user enters their info - specifically a sort on the "date"
[quoted text clipped - 9 lines]
>
> Any help with a solution is greatly appreciated. Thanks.
Keenly52 - 28 Mar 2005 17:23 GMT
Thank you very much - looks like it will do the trick. Cheers

> Try the following
>
[quoted text clipped - 25 lines]
> >
> > Any help with a solution is greatly appreciated. Thanks.
Keenly52 - 29 Mar 2005 06:59 GMT
Graham - I hate to impose but I ran into a couple of snags - btw it's Office
2003.

VB didn't recognize the variable bProtected (I never got past the 2nd line).
Only certain sections are protected
I need to password the protection and the code

Also, while I have you - is there any way a Macro can look at the value of a
Form field check box and then trigger certain actions depending on that
value? Or would I require a Control check box for that? If you had sample
code that would be awesome.

Many thanks again. Ken.

> Try the following
>
[quoted text clipped - 25 lines]
> >
> > Any help with a solution is greatly appreciated. Thanks.
Graham Mayor - 29 Mar 2005 08:38 GMT
The methodology is explained at
http://word.mvps.org/faqs/macrosvba/SpellcheckProtectDoc.htm. There is also
code on the MVPS web site which will help you fire an action based on the
result of a checkbox field.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Graham - I hate to impose but I ran into a couple of snags - btw it's
> Office 2003.
[quoted text clipped - 48 lines]
>>>
>>> Any help with a solution is greatly appreciated. Thanks.
Keenly52 - 29 Mar 2005 08:17 GMT
Graham - as I should have earlier, I have moved my enquiry over to the
programming discussion. Thanks again for your assistance. Cheers.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.