Re: Using Events with the Application Object
From: Alan Riley (kandariley_at_ozemail.com.au)
Date: 05/18/04
- Next message: Jeff W.: "Customizing symbols in Formatting Palette"
- Previous message: V Y: "loss of font settings"
- In reply to: Jim Gordon MVP: "Re: Using Events with the Application Object"
- Next in thread: Jim Gordon MVP: "Re: Using Events with the Application Object"
- Reply: Jim Gordon MVP: "Re: Using Events with the Application Object"
- Reply: John McGhie [MVP - Word]: "Re: Using Events with the Application Object"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 18 May 2004 14:34:40 +1000
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" <goldkey74@WarmerThanWarmMail.com> wrote in message
news:BCCEDA88.A522%goldkey74@WarmerThanWarmMail.com...
> 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 http://mvp.support.microsoft.com/
>
> Quoting from "Alan Riley" <kandariley@ozemail.com.au>, in article
> uvR#Yt$OEHA.2580@TK2MSFTNGP09.phx.gbl, 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
> >
> >
>
>
>
- Next message: Jeff W.: "Customizing symbols in Formatting Palette"
- Previous message: V Y: "loss of font settings"
- In reply to: Jim Gordon MVP: "Re: Using Events with the Application Object"
- Next in thread: Jim Gordon MVP: "Re: Using Events with the Application Object"
- Reply: Jim Gordon MVP: "Re: Using Events with the Application Object"
- Reply: John McGhie [MVP - Word]: "Re: Using Events with the Application Object"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|