|
-
Sep 12th, 2005, 09:25 PM
#1
Thread Starter
Addicted Member
onclick in MS word?
Hi all,
do you know any funciton in Ms word for key press?
Regards,
thirith.
-
Sep 13th, 2005, 06:39 AM
#2
Lively Member
Re: onclick in MS word?
Without api, the unreliable SendKeys Method:
VB Code:
Option Explicit
Sub SendKeysMethod()
SendKeys "H", True
SendKeys "E", True
SendKeys "L", True
SendKeys "L", True
SendKeys "O", True
End Sub
-
Sep 13th, 2005, 07:50 PM
#3
Thread Starter
Addicted Member
Re: onclick in MS word?
 Originally Posted by JustinLabenne
Without api, the unreliable SendKeys Method:
VB Code:
Option Explicit
Sub SendKeysMethod()
SendKeys "H", True
SendKeys "E", True
SendKeys "L", True
SendKeys "L", True
SendKeys "O", True
End Sub
thanks,
i mean when user type any text in the word document.
can we get the character of press in the documents?
-
Sep 13th, 2005, 07:50 PM
#4
Re: onclick in MS word?
With the API it is either SendMessage, PostMessage, or Keybd_event APIs. 
If you want to simulate a keypress you can also just use the TypeText method.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2005, 07:55 PM
#5
Re: onclick in MS word?
Oh, ok. Then you can create an event and trap for any changes or do a keyboard hook but it would only have to be hooking while word is the active app.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2005, 08:03 PM
#6
Thread Starter
Addicted Member
Re: onclick in MS word?
 Originally Posted by RobDog888
Oh, ok. Then you can create an event and trap for any changes or do a keyboard hook but it would only have to be hooking while word is the active app. 
Could you please give me some example code for me?
-
Sep 13th, 2005, 08:09 PM
#7
Re: onclick in MS word?
I dont think I can give an example because its a bit involved and I am talking in logic only.
GetAsyncKeyState API will do a global hook on the keyboard. For each keypress you would need to get the actie application and see if its word, but then they could be pressing a shortcut key sequence like for saving copy/paste that might not result in a document change.
What exactly are you trying to do as there may be a better solution to this.?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|