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 Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LEU - 26 Jul 2007 21:28 GMT
I found out that if you protect a section of a document Shapes and Drawings
do not work unless you unprotect the document first. The only reason I was
looking at protecting section(s) was to force users to use a form that when
saved would populate the tables in the document correctly. Without protecting
the section(s), is there a way that if a user clicks in a table to update it
will take them to my form instead to be used to edit or update the tables?
zkid - 27 Jul 2007 00:56 GMT
Can you trying restating the question please?

> I found out that if you protect a section of a document Shapes and Drawings
> do not work unless you unprotect the document first. The only reason I was
> looking at protecting section(s) was to force users to use a form that when
> saved would populate the tables in the document correctly. Without protecting
> the section(s), is there a way that if a user clicks in a table to update it
> will take them to my form instead to be used to edit or update the tables?
old man - 27 Jul 2007 01:04 GMT
Hi,

I wrote code to keep users out of a page in Word document by using the
WindowSelectionChange event. This approach may work for you:

1. Create a bookmarked range around the entire table that you don't want  
users to select.

2. Create a WindowSelectionChange that fires every time the selection is
changed and checks if the selection is in the bookmark created in the
previous step.

2. If it is (the user has clicked in the table) do a form.show and then
after the form is closed move the selection right before the table you want
to keep the user out of.

To use this event follow the instructions at:

http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm

If you have done this before it is more important to do exactly what the
article says  then understanding exacly is going on. If you create event
handlers you will soon get comfortable using this powerful feature of Word.

The WindowSelectionChange  does not seem to create a real performance hit
but some of the other events can result in sluggish performance of Word.

You can copy the code from here:
http://word.mvps.org/FAQs/Customization/ProtectWord2000PlusHeader.htm and
change it to check where the current selection point is after the
WindowSelectionChange is invoked.

Old Man

> I found out that if you protect a section of a document Shapes and Drawings
> do not work unless you unprotect the document first. The only reason I was
> looking at protecting section(s) was to force users to use a form that when
> saved would populate the tables in the document correctly. Without protecting
> the section(s), is there a way that if a user clicks in a table to update it
> will take them to my form instead to be used to edit or update the tables?
LEU - 27 Jul 2007 17:22 GMT
Hi,

I went through both the Writing application event procedures and How can I
prevent users from editing the header of a document in Word 2000 or higher.

1.  I copied the macros from How can I prevent users from editing the header
of a document in Word 2000 or higher into my template like they say but I can
still get into the header. I must be doing something wrong.

2. I followed the instructions in Writing application event procedures and
created the macros and the ThisApplication. Now how do I create a bookmark
range for the whole table and then tie it to the ThisApplication?

LEU

> Hi,
>
[quoted text clipped - 36 lines]
> > the section(s), is there a way that if a user clicks in a table to update it
> > will take them to my form instead to be used to edit or update the tables?
LEU - 27 Jul 2007 17:48 GMT
I retried the 'How can I prevent users from editing the header of a document
in Word 2000 or higher' and it worked this time. I must have missed a line
when I copied and pasted the macros.

LEU

> Hi,
>
[quoted text clipped - 36 lines]
> > the section(s), is there a way that if a user clicks in a table to update it
> > will take them to my form instead to be used to edit or update the tables?
LEU - 28 Jul 2007 00:26 GMT
I modified the last macro from ‘How can I prevent users from editing the
header of a document in Word 2000 or higher?’ to the following below. Now if
a user tries to open the header it goes to frmTable.Show. I have Created a
bookmark range around the entire table that I don't want users to select
called ‘bktable’. How do you add a new Case that if a user clicks inside
‘bktable’ it will go to frmTable.Show or do you have to use 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 if we're in it
Select Case Sel.StoryType
Case wdEvenPagesHeaderStory, wdFirstPageHeaderStory, wdPrimaryHeaderStory
   ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
   frmTable.Show
   Exit Sub
Case Else
End Select
End Sub

LEU

> Hi,
>
[quoted text clipped - 36 lines]
> > the section(s), is there a way that if a user clicks in a table to update it
> > will take them to my form instead to be used to edit or update the tables?
Russ - 28 Jul 2007 20:13 GMT
LEU,
Under the line 'Case Else' you could use something like:
If Selection.InRange(bktable) then
   frmTable.Show
End If

> I modified the last macro from ŒHow can I prevent users from editing the
> header of a document in Word 2000 or higher?¹ to the following below. Now if
[quoted text clipped - 59 lines]
>>> the section(s), is there a way that if a user clicks in a table to update it
>>> will take them to my form instead to be used to edit or update the tables?

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
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.