Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Trap paste event in text box

Geek News

Trap paste event in text box
chridevo 12/11/2008 7:00:02 AM
I need to strip selected html tags from text copied from MS Word into a text
box with rich text format. I have written a VBA procedure which works when I
call it by clicking on a button after paste but I would like it to run
automatically at the time of the paste event. I have looked at all the
available events on the event tab but can't find one to do this?
--
Chris
Re: Trap paste event in text box
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 12/11/2008 7:29:32 AM
Could you use the AfterUpdate (or Change) event of the text box to remove
any tags?

If this is A2007, PlainText() might help.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"chridevo" <chridevo[ at ]discussions.microsoft.com> wrote in message
news:AA7BE46B-0764-4B24-B540-82659887A987[ at ]microsoft.com...
[Quoted Text]
>I need to strip selected html tags from text copied from MS Word into a
>text
> box with rich text format. I have written a VBA procedure which works when
> I
> call it by clicking on a button after paste but I would like it to run
> automatically at the time of the paste event. I have looked at all the
> available events on the event tab but can't find one to do this?
> --
> Chris

Re: Trap paste event in text box
Dale Fye 12/11/2008 1:42:10 PM
Allen,

Thanks for the pointer. I've been dealing with HTML tags imbedded in
Sharepoint lists. This will be a great way to clean them up.

--
Dale

email address is invalid
Please reply to newsgroup only.



"Allen Browne" wrote:

[Quoted Text]
> Could you use the AfterUpdate (or Change) event of the text box to remove
> any tags?
>
> If this is A2007, PlainText() might help.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "chridevo" <chridevo[ at ]discussions.microsoft.com> wrote in message
> news:AA7BE46B-0764-4B24-B540-82659887A987[ at ]microsoft.com...
> >I need to strip selected html tags from text copied from MS Word into a
> >text
> > box with rich text format. I have written a VBA procedure which works when
> > I
> > call it by clicking on a button after paste but I would like it to run
> > automatically at the time of the paste event. I have looked at all the
> > available events on the event tab but can't find one to do this?
> > --
> > Chris
>
>
Re: Trap paste event in text box
"Stuart McCall" <smccall[ at ]myunrealbox.com> 12/11/2008 5:28:14 PM
"chridevo" <chridevo[ at ]discussions.microsoft.com> wrote in message
news:AA7BE46B-0764-4B24-B540-82659887A987[ at ]microsoft.com...
[Quoted Text]
>I need to strip selected html tags from text copied from MS Word into a
>text
> box with rich text format. I have written a VBA procedure which works when
> I
> call it by clicking on a button after paste but I would like it to run
> automatically at the time of the paste event. I have looked at all the
> available events on the event tab but can't find one to do this?
> --
> Chris

TTBOMK a paste doesn't fire any of the Access events, but perhaps you could
do this differently, by grabbing the text from the clipboard instead of
waiting for a paste? Here's some code that will enable you to do that:

http://www.smccall.demon.co.uk/MiscApi.htm#Clipboard


Re: Trap paste event in text box
chridevo 12/12/2008 3:47:00 AM
Allen, Thanks for the quick response. I revisited the update and change
events but neither seem to do what I need. The update event happens too late
and, in this context, the change event reminds me of a dog chasing it's tail.
I think Stuart (below) has the best approach for me.
--
Chris


"Allen Browne" wrote:

[Quoted Text]
> Could you use the AfterUpdate (or Change) event of the text box to remove
> any tags?
>
> If this is A2007, PlainText() might help.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "chridevo" <chridevo[ at ]discussions.microsoft.com> wrote in message
> news:AA7BE46B-0764-4B24-B540-82659887A987[ at ]microsoft.com...
> >I need to strip selected html tags from text copied from MS Word into a
> >text
> > box with rich text format. I have written a VBA procedure which works when
> > I
> > call it by clicking on a button after paste but I would like it to run
> > automatically at the time of the paste event. I have looked at all the
> > available events on the event tab but can't find one to do this?
> > --
> > Chris
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net