Thread: [Solved] Right click in Macro
View Single Post
 
Old 04-05-2011, 08:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi M Schroff,

I don't really understand why you want a sub with the right-click approach, when you could use a sub like:
Code:
Sub Demo()
Selection.Range.CheckSpelling
End Sub
The Sendkeys code is what you'd add to a sub to simulate the right-click after something has been selected (either by the user before running the sub or by the sub itself). For example:
Code:
Sub Demo()
Dim StrWrd As Range
For Each StrWrd In ActiveDocument.Paragraphs(1).Range.Words
  With StrWrd
    If .SpellingErrors.Count > 0 Then
      .Select
      SendKeys "+{F10}", True
      Exit Sub
    End If
  End With
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote