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 / Programming / July 2007

Tip: Looking for answers? Try searching our database.

Table protection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fuzzhead - 28 Jul 2007 17:24 GMT
I was looking at other posts and found out how to protect my headers and
footers using the information in ‘How can I prevent users from editing the
header of a document in Word 2000 or higher?’ (See below). Can you use this
same idea to protect a table in my document?  I have created a bookmark range
around the entire table that I don't want users to be able to change and
called it ‘bktbl’. How do you add a new Case that if a user clicks inside
‘bktbl’ it will go to right before the bookmark or how would you add a whole
new macro?

Private Sub wdApp_WindowSelectionChange(ByVal Sel As Selection)
'quit if active doc isn't attached to this template
If ActiveDocument.AttachedTemplate <> ThisDocument Then Exit Sub
'get out of the header/footer if we're in it
Select Case Sel.StoryType
Case wdEvenPagesFooterStory, wdEvenPagesHeaderStory, _
      wdFirstPageFooterStory, wdFirstPageHeaderStory, _
       wdPrimaryFooterStory, wdPrimaryHeaderStory
     ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
     Exit Sub
Case Else
End Select

End Sub

Fuzzhead
Jay Freedman - 28 Jul 2007 21:23 GMT
Insert another bookmark where you want the cursor to land -- before or
after the table, or anywhere else except inside the bktbl bookmark.
I'll arbitrarily use the name bkbeforetbl for it. Then modify the code
to

Case Else
   If Sel.Range.InRange(ActiveDocument.Bookmarks("bktbl").Range) Then
           ActiveDocument.Bookmarks("bkbeforetbl").Select
   End If
End Select

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>I was looking at other posts and found out how to protect my headers and
>footers using the information in ‘How can I prevent users from editing the
[quoted text clipped - 21 lines]
>
>Fuzzhead
Fuzzhead - 28 Jul 2007 22:42 GMT
Thanks Jay for the response.

It worked great when creating a new document from the template. Is there a
way to duplicate this in a converted WordPerfect document? I convert the
document and part of that is deleting the first page of the converted
document and then inserting my template which becomes the new first page.
When I do this and open VBA Editor in the ThisDocument none of the macros are
there. Is there some thing special that has to be done for those macros to
get populated into ThisDocument?

Fuzzhead

> Insert another bookmark where you want the cursor to land -- before or
> after the table, or anywhere else except inside the bktbl bookmark.
[quoted text clipped - 39 lines]
> >
> >Fuzzhead
Jay Freedman - 28 Jul 2007 23:28 GMT
The macros are in the ThisDocument of the template. Inserting a page
(or any other part) from a template into a document doesn't carry
along the macros, or the toolbars or styles or any of the other things
that live in the template.

When you create a new document based on the template, the document
retains a link back to the template, and the macros (which are still
in the template, not in the document) are available whenever the
document is open. However, your converted WordPerfect document is
_not_ associated with your template because they don't have that
linkage.

To associate the template with an existing document, go to Tools >
Templates & Add-Ins, click the Attach button, and choose your template
to become 'the attached template' in place of whatever is already
there (probably Normal.dot, which is attached in the absence of any
other template). Then save, close, and reopen the document, and the
macros should run.

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>Thanks Jay for the response.
>
[quoted text clipped - 51 lines]
>> >
>> >Fuzzhead
Fuzzhead - 29 Jul 2007 00:22 GMT
Thank you for all your help. I just added the following to my conversion
macro and it did exactly what you said.

With ActiveDocument
   .AttachedTemplate = "C:\MyMaster.dot"
End With

Fuzzhead

> The macros are in the ThisDocument of the template. Inserting a page
> (or any other part) from a template into a document doesn't carry
[quoted text clipped - 77 lines]
> >> >
> >> >Fuzzhead
 
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.