Using Events with the Application Object

A

Alan Riley

Hello All

Does anyone know if the WindowSelectionChange application event should be
available within Word for Mac 2001 & X, or how to get it working, as it
won't work for me? I have searched high and low for information on it but
have found nothing.

I've been using it successfully in Word for Windows to ensure that fields,
bookmarks and other sensitive items are not overwritten. It allows the new
selection to be analysed before the user can to do anything with it. I have
already tried section protection to achieve the same thing (which works as
far as protection is concerned), but it disabled too much functionality (in
the unprotected sections !!).

I could also use the EditCut and EditClear events to stop deletion but the
main danger is overtyping, so I need something extra to stop a damaging
action. Is there any other way to achieve this, eg. an "InsertText" event??

Any help would be much appreciated.

Thanks
Alan Riley
ADR Software
 
J

John McGhie [MVP - Word]

Hi Alan:

I am not sure that anyone in this group is sufficiently into heavy
development to answer that question.

I will ask Microsoft Australia for you, but please do not expect a "quick"
answer.

Cheers


from "Alan said:
Hello All

Does anyone know if the WindowSelectionChange application event should be
available within Word for Mac 2001 & X, or how to get it working, as it
won't work for me? I have searched high and low for information on it but
have found nothing.

I've been using it successfully in Word for Windows to ensure that fields,
bookmarks and other sensitive items are not overwritten. It allows the new
selection to be analysed before the user can to do anything with it. I have
already tried section protection to achieve the same thing (which works as
far as protection is concerned), but it disabled too much functionality (in
the unprotected sections !!).

I could also use the EditCut and EditClear events to stop deletion but the
main danger is overtyping, so I need something extra to stop a damaging
action. Is there any other way to achieve this, eg. an "InsertText" event??

Any help would be much appreciated.

Thanks
Alan Riley
ADR Software

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
A

Alan Riley

Thanks John - I've posted it to word.vba.general also, just on the off
chance.

Alan
 
J

Jim Gordon MVP

Hi Alan,

The visual basic model for Word on the Mac is very close to VBA 5 for
Windows. If WindowSelectionChange was something new in VBA 6 then it won't
work on Macintosh versions of Word. I did not find WindowSelectionChange
in the object editor for Mac Word. What are you trying to accomplish with
this command?

I'm not entirely sure whether you want to delete text or cut it to the
clipboard. Cut is different from Delete. At it's simplest, you can use
Selection.Delete to delete selected text. You can move text to and from the
clipboard as well as to and from objects that accept text such as text boxes
and autoshapes. You can also put text into variables and arrays within
Visual Basic so that you can store it and use it later in your code so you
don't have to worry about losing text that you remove but might want to use
later on. You could create one or more hidden Word documents to use as
storage for text or objects.

I hope this answer helps somewhat.

-Jim

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info
 
A

Alan Riley

Hi Jim

Thanks for the reply. That would explain it - do you know if/when they will
upgrade to VB6 for Mac?

I am developing automated templates that enforce a standard by providing the
users with a range of tools whilst preventing them (as far as possible) from
making unwanted modifications. The easiest ways I found to do this was by:

- Protecting vulnerable areas such as Title Pages, Headers/Footers, Table of
Contents etc using sections;
- Providing a VBA data entry form that allows the user to populate key
document details in protected areas;
- Automating additonal functionality through custom toolbars.

Unfortunately, the Word functionality that is disabled, when protection is
turned on, is not restricted to the protected sections, eg. 'spell check
underlining', Page Setup, Track Changes etc. are not available in the rest
of the document. Additional coding will get round some of this, ie. custom
macros to peform the actions with 'unprotect' before processing, but this
opens me up for heaps more testing and support.

Without protection in these sections, users can overwrite fields, remove
bookmarks, change styles and layouts etc, thus preventing the data entry
form and automation from working as efficiently (throwing up a comparible
headache to that above).

Anyway, I found a workable solution (in Word 2000 for Windows atleast), that
meant I could remove the protection but still prevent users from getting
into the vulnerable sections. The WindowSelectionChange event allows you to
check where the selection is, what it contains and whether the user should
be allowed to work there. If in an undesirable area, the selection can be
moved to an area of my choice. eg.

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)

If Sel.Information(wdActiveEndSectionNumber) = 1 Then
Msgbox "Use Data Entry Form"
Selection.GoTo What:=wdGoToSection, Count:=2
End If

End Sub

This doesn't work on the Mac, hence my problem.

The reason I was thinking about EditCut, EditClear or EditPaste was because
they are events that I can trap to determine where the selection was before
continuing. But the main culprit for disruption is over typing on the
selection (for which there is no menu event to usurp - or is there ??).

Thanks again for your help. Any other suggestions would be great.

Alan Riley
ADR Software
 
J

Jim Gordon MVP

Hi Alan,

The chances that Mac Office will support VBA version 6 are zero in the
foreseeable future. VBA itself will morph into VBA.Net. After that happens
the Mac Business unit will have to analyze how to deal with automation and
see what they can do.

The commands you are using seem to be from VBA version 6. In version 5 the
protection commands are document level:
Protection Type Required Long. The protection type for the specified
document. Can be one of the following WdProtectionType constants:
wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyRevisions, or
wdNoProtection.

You can protect forms at the section level.

I don't know a way to intercept the keyboard to stop people from selecting
and changing the document. Maybe you could have a hidden copy of the
document and work with that somehow to keep a document without changes. You
could compare text strings.

You might want to try one of the microsoft.public.word.vba newsgroups to see
if there are code samples there that might be of help. Anything that works
in VBA version 5 should be fair game for you.

-Jim


Hi Jim

Thanks for the reply. That would explain it - do you know if/when they will
upgrade to VB6 for Mac?

I am developing automated templates that enforce a standard by providing the
users with a range of tools whilst preventing them (as far as possible) from
making unwanted modifications. The easiest ways I found to do this was by:

- Protecting vulnerable areas such as Title Pages, Headers/Footers, Table of
Contents etc using sections;
- Providing a VBA data entry form that allows the user to populate key
document details in protected areas;
- Automating additonal functionality through custom toolbars.

Unfortunately, the Word functionality that is disabled, when protection is
turned on, is not restricted to the protected sections, eg. 'spell check
underlining', Page Setup, Track Changes etc. are not available in the rest
of the document. Additional coding will get round some of this, ie. custom
macros to peform the actions with 'unprotect' before processing, but this
opens me up for heaps more testing and support.

Without protection in these sections, users can overwrite fields, remove
bookmarks, change styles and layouts etc, thus preventing the data entry
form and automation from working as efficiently (throwing up a comparible
headache to that above).

Anyway, I found a workable solution (in Word 2000 for Windows atleast), that
meant I could remove the protection but still prevent users from getting
into the vulnerable sections. The WindowSelectionChange event allows you to
check where the selection is, what it contains and whether the user should
be allowed to work there. If in an undesirable area, the selection can be
moved to an area of my choice. eg.

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)

If Sel.Information(wdActiveEndSectionNumber) = 1 Then
Msgbox "Use Data Entry Form"
Selection.GoTo What:=wdGoToSection, Count:=2
End If

End Sub

This doesn't work on the Mac, hence my problem.

The reason I was thinking about EditCut, EditClear or EditPaste was because
they are events that I can trap to determine where the selection was before
continuing. But the main culprit for disruption is over typing on the
selection (for which there is no menu event to usurp - or is there ??).

Thanks again for your help. Any other suggestions would be great.

Alan Riley
ADR Software

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info
 
A

Alan Riley

Thanks Jim

I think I'll have to play around with protection a bit more - see if I can
get it to work closer to my requirements.

Alan Riley
ADR Software

Jim Gordon MVP said:
Hi Alan,

The chances that Mac Office will support VBA version 6 are zero in the
foreseeable future. VBA itself will morph into VBA.Net. After that happens
the Mac Business unit will have to analyze how to deal with automation and
see what they can do.

The commands you are using seem to be from VBA version 6. In version 5 the
protection commands are document level:
Protection Type Required Long. The protection type for the specified
document. Can be one of the following WdProtectionType constants:
wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyRevisions, or
wdNoProtection.

You can protect forms at the section level.

I don't know a way to intercept the keyboard to stop people from selecting
and changing the document. Maybe you could have a hidden copy of the
document and work with that somehow to keep a document without changes. You
could compare text strings.

You might want to try one of the microsoft.public.word.vba newsgroups to see
if there are code samples there that might be of help. Anything that works
in VBA version 5 should be fair game for you.

-Jim


Hi Jim

Thanks for the reply. That would explain it - do you know if/when they will
upgrade to VB6 for Mac?

I am developing automated templates that enforce a standard by providing the
users with a range of tools whilst preventing them (as far as possible) from
making unwanted modifications. The easiest ways I found to do this was by:

- Protecting vulnerable areas such as Title Pages, Headers/Footers, Table of
Contents etc using sections;
- Providing a VBA data entry form that allows the user to populate key
document details in protected areas;
- Automating additonal functionality through custom toolbars.

Unfortunately, the Word functionality that is disabled, when protection is
turned on, is not restricted to the protected sections, eg. 'spell check
underlining', Page Setup, Track Changes etc. are not available in the rest
of the document. Additional coding will get round some of this, ie. custom
macros to peform the actions with 'unprotect' before processing, but this
opens me up for heaps more testing and support.

Without protection in these sections, users can overwrite fields, remove
bookmarks, change styles and layouts etc, thus preventing the data entry
form and automation from working as efficiently (throwing up a comparible
headache to that above).

Anyway, I found a workable solution (in Word 2000 for Windows atleast), that
meant I could remove the protection but still prevent users from getting
into the vulnerable sections. The WindowSelectionChange event allows you to
check where the selection is, what it contains and whether the user should
be allowed to work there. If in an undesirable area, the selection can be
moved to an area of my choice. eg.

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)

If Sel.Information(wdActiveEndSectionNumber) = 1 Then
Msgbox "Use Data Entry Form"
Selection.GoTo What:=wdGoToSection, Count:=2
End If

End Sub

This doesn't work on the Mac, hence my problem.

The reason I was thinking about EditCut, EditClear or EditPaste was because
they are events that I can trap to determine where the selection was before
continuing. But the main culprit for disruption is over typing on the
selection (for which there is no menu event to usurp - or is there ??).

Thanks again for your help. Any other suggestions would be great.

Alan Riley
ADR Software

Jim Gordon MVP said:
Hi Alan,

The visual basic model for Word on the Mac is very close to VBA 5 for
Windows. If WindowSelectionChange was something new in VBA 6 then it won't
work on Macintosh versions of Word. I did not find WindowSelectionChange
in the object editor for Mac Word. What are you trying to accomplish with
this command?

I'm not entirely sure whether you want to delete text or cut it to the
clipboard. Cut is different from Delete. At it's simplest, you can use
Selection.Delete to delete selected text. You can move text to and from the
clipboard as well as to and from objects that accept text such as text boxes
and autoshapes. You can also put text into variables and arrays within
Visual Basic so that you can store it and use it later in your code so you
don't have to worry about losing text that you remove but might want to use
later on. You could create one or more hidden Word documents to use as
storage for text or objects.

I hope this answer helps somewhat.

-Jim

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info

Quoting from "Alan Riley" <[email protected]>, in article
uvR#[email protected], on [DATE:

Hello All

Does anyone know if the WindowSelectionChange application event should be
available within Word for Mac 2001 & X, or how to get it working, as it
won't work for me? I have searched high and low for information on it but
have found nothing.

I've been using it successfully in Word for Windows to ensure that fields,
bookmarks and other sensitive items are not overwritten. It allows the new
selection to be analysed before the user can to do anything with it. I have
already tried section protection to achieve the same thing (which
works
as
far as protection is concerned), but it disabled too much
functionality
(in
the unprotected sections !!).

I could also use the EditCut and EditClear events to stop deletion but the
main danger is overtyping, so I need something extra to stop a damaging
action. Is there any other way to achieve this, eg. an "InsertText" event??

Any help would be much appreciated.

Thanks
Alan Riley
ADR Software

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info
 
J

John McGhie [MVP - Word]

Hi Alan:

We know very definitely that they will *not* upgrade VBA on the Mac. VBA is
going away: they won't upgrade it on the PC either.

New development should be done in VB.NNET, which is the upgrade path. There
is currently no plan to port VB.NET to the Mac, due to lack of user demand.

For a genuine cross-platform solution, you could investigate RealBasic,
which is included as an Extra with Office X and Office 2004 on the Mac, and
is also available for Win32 PCs.

In the meantime, MS Australia has a support case open on your problem. I'm
pretty sure they are getting nowhere, because I am pretty sure that the
answer is "no, it doesn't exist on the Mac" :)

However, if I were doing your project, I would not choose that method on the
PC either. I would be much more inclined to employ InfoPath in Word 2003 to
build an XML solution to this problem.

I would go so far as to say that trying to intercept user commands the way
you are has never proven successful for me. The problem is not so much that
it can't be done, but that by the time you have exerted sufficient control
over Word to "prevent" the user from doing the wrong thing, you end up
handing them a virtually unusable copy of MS Word. When you do that, you
piss the users off, and they simply find a way around you.

Users do not come to work to do a bad job, so I find it's a lot more
productive to put my effort into telling them how and why not to do what I
don't want them to do. Provide a Wizard if it's complex, but put my effort
into making the "right" way the "easy" way.

For example: A form into which the user types, that then traps the strings
and inserts them into a template the user never sees. That way, many of the
user entries can be chosen from drop-down lists or validated on input.

In my circumstances, these techniques work better than trying to lock down
Word so they simply "can't" do the wrong thing :)

Anyway: I am still awaiting a response on your support case.

Cheers


from "Alan said:
Hi Jim

Thanks for the reply. That would explain it - do you know if/when they will
upgrade to VB6 for Mac?

I am developing automated templates that enforce a standard by providing the
users with a range of tools whilst preventing them (as far as possible) from
making unwanted modifications. The easiest ways I found to do this was by:

- Protecting vulnerable areas such as Title Pages, Headers/Footers, Table of
Contents etc using sections;
- Providing a VBA data entry form that allows the user to populate key
document details in protected areas;
- Automating additonal functionality through custom toolbars.

Unfortunately, the Word functionality that is disabled, when protection is
turned on, is not restricted to the protected sections, eg. 'spell check
underlining', Page Setup, Track Changes etc. are not available in the rest
of the document. Additional coding will get round some of this, ie. custom
macros to peform the actions with 'unprotect' before processing, but this
opens me up for heaps more testing and support.

Without protection in these sections, users can overwrite fields, remove
bookmarks, change styles and layouts etc, thus preventing the data entry
form and automation from working as efficiently (throwing up a comparible
headache to that above).

Anyway, I found a workable solution (in Word 2000 for Windows atleast), that
meant I could remove the protection but still prevent users from getting
into the vulnerable sections. The WindowSelectionChange event allows you to
check where the selection is, what it contains and whether the user should
be allowed to work there. If in an undesirable area, the selection can be
moved to an area of my choice. eg.

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)

If Sel.Information(wdActiveEndSectionNumber) = 1 Then
Msgbox "Use Data Entry Form"
Selection.GoTo What:=wdGoToSection, Count:=2
End If

End Sub

This doesn't work on the Mac, hence my problem.

The reason I was thinking about EditCut, EditClear or EditPaste was because
they are events that I can trap to determine where the selection was before
continuing. But the main culprit for disruption is over typing on the
selection (for which there is no menu event to usurp - or is there ??).

Thanks again for your help. Any other suggestions would be great.

Alan Riley
ADR Software

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
A

Alan Riley

Hi John

Thanks for the advice and checking with Microsoft. It certainly doesn't seem
worthwhile me pursuing this avenue any further with this project. It's a
shame though as I got very close to getting what my customer had hoped for,
without having to compromise any useability.

I will opt for no protection, forgo control over layout, code to cope with
deleted bookmarks and fields, save key values in document variables, and
make my automation more resilient to layout changes.

Thanks also for the alternatives.

Alan Riley
ADR Software


John McGhie said:
Hi Alan:

We know very definitely that they will *not* upgrade VBA on the Mac. VBA is
going away: they won't upgrade it on the PC either.

New development should be done in VB.NNET, which is the upgrade path. There
is currently no plan to port VB.NET to the Mac, due to lack of user demand.

For a genuine cross-platform solution, you could investigate RealBasic,
which is included as an Extra with Office X and Office 2004 on the Mac, and
is also available for Win32 PCs.

In the meantime, MS Australia has a support case open on your problem. I'm
pretty sure they are getting nowhere, because I am pretty sure that the
answer is "no, it doesn't exist on the Mac" :)

However, if I were doing your project, I would not choose that method on the
PC either. I would be much more inclined to employ InfoPath in Word 2003 to
build an XML solution to this problem.

I would go so far as to say that trying to intercept user commands the way
you are has never proven successful for me. The problem is not so much that
it can't be done, but that by the time you have exerted sufficient control
over Word to "prevent" the user from doing the wrong thing, you end up
handing them a virtually unusable copy of MS Word. When you do that, you
piss the users off, and they simply find a way around you.

Users do not come to work to do a bad job, so I find it's a lot more
productive to put my effort into telling them how and why not to do what I
don't want them to do. Provide a Wizard if it's complex, but put my effort
into making the "right" way the "easy" way.

For example: A form into which the user types, that then traps the strings
and inserts them into a template the user never sees. That way, many of the
user entries can be chosen from drop-down lists or validated on input.

In my circumstances, these techniques work better than trying to lock down
Word so they simply "can't" do the wrong thing :)

Anyway: I am still awaiting a response on your support case.

Cheers


This responds to article <#[email protected]>, from "Alan
Riley said:
Hi Jim

Thanks for the reply. That would explain it - do you know if/when they will
upgrade to VB6 for Mac?

I am developing automated templates that enforce a standard by providing the
users with a range of tools whilst preventing them (as far as possible) from
making unwanted modifications. The easiest ways I found to do this was by:

- Protecting vulnerable areas such as Title Pages, Headers/Footers, Table of
Contents etc using sections;
- Providing a VBA data entry form that allows the user to populate key
document details in protected areas;
- Automating additonal functionality through custom toolbars.

Unfortunately, the Word functionality that is disabled, when protection is
turned on, is not restricted to the protected sections, eg. 'spell check
underlining', Page Setup, Track Changes etc. are not available in the rest
of the document. Additional coding will get round some of this, ie. custom
macros to peform the actions with 'unprotect' before processing, but this
opens me up for heaps more testing and support.

Without protection in these sections, users can overwrite fields, remove
bookmarks, change styles and layouts etc, thus preventing the data entry
form and automation from working as efficiently (throwing up a comparible
headache to that above).

Anyway, I found a workable solution (in Word 2000 for Windows atleast), that
meant I could remove the protection but still prevent users from getting
into the vulnerable sections. The WindowSelectionChange event allows you to
check where the selection is, what it contains and whether the user should
be allowed to work there. If in an undesirable area, the selection can be
moved to an area of my choice. eg.

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)

If Sel.Information(wdActiveEndSectionNumber) = 1 Then
Msgbox "Use Data Entry Form"
Selection.GoTo What:=wdGoToSection, Count:=2
End If

End Sub

This doesn't work on the Mac, hence my problem.

The reason I was thinking about EditCut, EditClear or EditPaste was because
they are events that I can trap to determine where the selection was before
continuing. But the main culprit for disruption is over typing on the
selection (for which there is no menu event to usurp - or is there ??).

Thanks again for your help. Any other suggestions would be great.

Alan Riley
ADR Software

Jim Gordon MVP said:
Hi Alan,

The visual basic model for Word on the Mac is very close to VBA 5 for
Windows. If WindowSelectionChange was something new in VBA 6 then it won't
work on Macintosh versions of Word. I did not find WindowSelectionChange
in the object editor for Mac Word. What are you trying to accomplish with
this command?

I'm not entirely sure whether you want to delete text or cut it to the
clipboard. Cut is different from Delete. At it's simplest, you can use
Selection.Delete to delete selected text. You can move text to and from the
clipboard as well as to and from objects that accept text such as text boxes
and autoshapes. You can also put text into variables and arrays within
Visual Basic so that you can store it and use it later in your code so you
don't have to worry about losing text that you remove but might want to use
later on. You could create one or more hidden Word documents to use as
storage for text or objects.

I hope this answer helps somewhat.

-Jim

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info

Quoting from "Alan Riley" <[email protected]>, in article
uvR#[email protected], on [DATE:

Hello All

Does anyone know if the WindowSelectionChange application event should be
available within Word for Mac 2001 & X, or how to get it working, as it
won't work for me? I have searched high and low for information on it but
have found nothing.

I've been using it successfully in Word for Windows to ensure that fields,
bookmarks and other sensitive items are not overwritten. It allows the new
selection to be analysed before the user can to do anything with it. I have
already tried section protection to achieve the same thing (which
works
as
far as protection is concerned), but it disabled too much
functionality
(in
the unprotected sections !!).

I could also use the EditCut and EditClear events to stop deletion but the
main danger is overtyping, so I need something extra to stop a damaging
action. Is there any other way to achieve this, eg. an "InsertText" event??

Any help would be much appreciated.

Thanks
Alan Riley
ADR Software

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
J

John McGhie [MVP - Word]

Hi Alan:

OK, Microsoft answered officially: None of the new events created post 1998
have made it into MacWord.

Sorry about that.

You don't have to forgo control over layout: simply collect your data from
the user, then fire it programmatically into a template the user never sees
:) Open said template in the background (in an instance of Word that is
not visible) with a password and do not allow the window to become visible:
the user will never know the template is even open, let alone get edit
access to it.

Cheers


from "Alan said:
Hi John

Thanks for the advice and checking with Microsoft. It certainly doesn't seem
worthwhile me pursuing this avenue any further with this project. It's a
shame though as I got very close to getting what my customer had hoped for,
without having to compromise any useability.

I will opt for no protection, forgo control over layout, code to cope with
deleted bookmarks and fields, save key values in document variables, and
make my automation more resilient to layout changes.

Thanks also for the alternatives.

Alan Riley
ADR Software


John McGhie said:
Hi Alan:

We know very definitely that they will *not* upgrade VBA on the Mac. VBA is
going away: they won't upgrade it on the PC either.

New development should be done in VB.NNET, which is the upgrade path. There
is currently no plan to port VB.NET to the Mac, due to lack of user demand.

For a genuine cross-platform solution, you could investigate RealBasic,
which is included as an Extra with Office X and Office 2004 on the Mac, and
is also available for Win32 PCs.

In the meantime, MS Australia has a support case open on your problem. I'm
pretty sure they are getting nowhere, because I am pretty sure that the
answer is "no, it doesn't exist on the Mac" :)

However, if I were doing your project, I would not choose that method on the
PC either. I would be much more inclined to employ InfoPath in Word 2003 to
build an XML solution to this problem.

I would go so far as to say that trying to intercept user commands the way
you are has never proven successful for me. The problem is not so much that
it can't be done, but that by the time you have exerted sufficient control
over Word to "prevent" the user from doing the wrong thing, you end up
handing them a virtually unusable copy of MS Word. When you do that, you
piss the users off, and they simply find a way around you.

Users do not come to work to do a bad job, so I find it's a lot more
productive to put my effort into telling them how and why not to do what I
don't want them to do. Provide a Wizard if it's complex, but put my effort
into making the "right" way the "easy" way.

For example: A form into which the user types, that then traps the strings
and inserts them into a template the user never sees. That way, many of the
user entries can be chosen from drop-down lists or validated on input.

In my circumstances, these techniques work better than trying to lock down
Word so they simply "can't" do the wrong thing :)

Anyway: I am still awaiting a response on your support case.

Cheers


This responds to article <#[email protected]>, from "Alan
Riley said:
Hi Jim

Thanks for the reply. That would explain it - do you know if/when they will
upgrade to VB6 for Mac?

I am developing automated templates that enforce a standard by providing the
users with a range of tools whilst preventing them (as far as possible) from
making unwanted modifications. The easiest ways I found to do this was by:

- Protecting vulnerable areas such as Title Pages, Headers/Footers, Table of
Contents etc using sections;
- Providing a VBA data entry form that allows the user to populate key
document details in protected areas;
- Automating additonal functionality through custom toolbars.

Unfortunately, the Word functionality that is disabled, when protection is
turned on, is not restricted to the protected sections, eg. 'spell check
underlining', Page Setup, Track Changes etc. are not available in the rest
of the document. Additional coding will get round some of this, ie. custom
macros to peform the actions with 'unprotect' before processing, but this
opens me up for heaps more testing and support.

Without protection in these sections, users can overwrite fields, remove
bookmarks, change styles and layouts etc, thus preventing the data entry
form and automation from working as efficiently (throwing up a comparible
headache to that above).

Anyway, I found a workable solution (in Word 2000 for Windows atleast), that
meant I could remove the protection but still prevent users from getting
into the vulnerable sections. The WindowSelectionChange event allows you to
check where the selection is, what it contains and whether the user should
be allowed to work there. If in an undesirable area, the selection can be
moved to an area of my choice. eg.

Private Sub App_WindowSelectionChange(ByVal Sel As Selection)

If Sel.Information(wdActiveEndSectionNumber) = 1 Then
Msgbox "Use Data Entry Form"
Selection.GoTo What:=wdGoToSection, Count:=2
End If

End Sub

This doesn't work on the Mac, hence my problem.

The reason I was thinking about EditCut, EditClear or EditPaste was because
they are events that I can trap to determine where the selection was before
continuing. But the main culprit for disruption is over typing on the
selection (for which there is no menu event to usurp - or is there ??).

Thanks again for your help. Any other suggestions would be great.

Alan Riley
ADR Software

Hi Alan,

The visual basic model for Word on the Mac is very close to VBA 5 for
Windows. If WindowSelectionChange was something new in VBA 6 then it won't
work on Macintosh versions of Word. I did not find WindowSelectionChange
in the object editor for Mac Word. What are you trying to accomplish with
this command?

I'm not entirely sure whether you want to delete text or cut it to the
clipboard. Cut is different from Delete. At it's simplest, you can use
Selection.Delete to delete selected text. You can move text to and from
the
clipboard as well as to and from objects that accept text such as text
boxes
and autoshapes. You can also put text into variables and arrays within
Visual Basic so that you can store it and use it later in your code so you
don't have to worry about losing text that you remove but might want to
use
later on. You could create one or more hidden Word documents to use as
storage for text or objects.

I hope this answer helps somewhat.

-Jim

--
Jim Gordon
Mac MVP

MVPs are not Microsoft Employees
MVP info

Quoting from "Alan Riley" <[email protected]>, in article
uvR#[email protected], on [DATE:

Hello All

Does anyone know if the WindowSelectionChange application event should
be
available within Word for Mac 2001 & X, or how to get it working, as it
won't work for me? I have searched high and low for information on it
but
have found nothing.

I've been using it successfully in Word for Windows to ensure that
fields,
bookmarks and other sensitive items are not overwritten. It allows the
new
selection to be analysed before the user can to do anything with it. I
have
already tried section protection to achieve the same thing (which works
as
far as protection is concerned), but it disabled too much functionality
(in
the unprotected sections !!).

I could also use the EditCut and EditClear events to stop deletion but
the
main danger is overtyping, so I need something extra to stop a damaging
action. Is there any other way to achieve this, eg. an "InsertText"
event??

Any help would be much appreciated.

Thanks
Alan Riley
ADR Software

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
J

John McGhie [MVP - Word]

You should not be attempting to load Windows 2000 on a Macintosh... :)

Seriously, this is a Macintosh newsgroup: if you do not know enough to get
your question into the correct group, perhaps you might consider hiring a
professional to install Windows 2000 for you? It's not very difficult, but
installation does require a basic level of computer skill.

Cheers


This responds to article
from "george" said:
have problem when i setup the windows 2000. When the widows are starting for
the first time shows the message: ***STOP:0x0000007B (0x827D1730, 0xc0000185,
0x00000000, 0x00000000) INACCESSIBLE_BOOT_DEVICE

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top