WorkingVBA
Registered User.
- Local time
- Today, 00:36
- Joined
- Jul 3, 2013
- Messages
- 33
Hi,
I am trying to add a "paste plain text" button in a textbox with rich text enabled to prevent formatted text from being entered. (there may be a better way to do this and if you know it I am all ears)
The idea is that I paste the content of the clip board in the cursor's location which is captured in the Textbox's On_Exit event in a global Integer variable vProjNotesPos:
In the click event of the "Paste as Text" button I set focus to the text box and set the cursor location to the captured position. Then I paste the content of the clip board:
This works just the first time around. When I click the button a second time it places the cursor at the end of the text string instead of where it is was before I clicked the button a second time. I have looked in a number of places and it seems that somehow the selStart property has to be reset. I tried saving and a number of other things but to no avail. Any ideas? BTW, Merry Christmas
I am trying to add a "paste plain text" button in a textbox with rich text enabled to prevent formatted text from being entered. (there may be a better way to do this and if you know it I am all ears)
The idea is that I paste the content of the clip board in the cursor's location which is captured in the Textbox's On_Exit event in a global Integer variable vProjNotesPos:
Private Sub ProjNotes_Exit(Cancel As Integer)
vProjNotesPos = ProjNotes.SelStart
End SubIn the click event of the "Paste as Text" button I set focus to the text box and set the cursor location to the captured position. Then I paste the content of the clip board:
Me.ProjNotes.SetFocus
Me.ProjNotes.SelStart = vProjNotesPos
DoCmd.RunCommand (acCmdPaste)
Me.ProjNotes.SelStart = vProjNotesPos
DoCmd.RunCommand (acCmdPaste)
This works just the first time around. When I click the button a second time it places the cursor at the end of the text string instead of where it is was before I clicked the button a second time. I have looked in a number of places and it seems that somehow the selStart property has to be reset. I tried saving and a number of other things but to no avail. Any ideas? BTW, Merry Christmas
Last edited: