Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2006

Tip: Looking for answers? Try searching our database.

What am I missing?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
keithb - 19 Dec 2005 23:26 GMT
What am I missing? This code is in the "ThisWorkbook" Module; however it
does not execute ShiftLeft and ShiftRight when the designated keys are
pressed.

Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
   Application.OnKey "%{LEFT}", "ShiftLeft"
   Application.OnKey "%{RIGHT}", "ShiftRight"
End Sub

Sub ShiftLeft()
   With Selection
       If (.IndentLevel > 0) Then
           .InsertIndent -1
        Else
           Beep
       End If
   End With
End Sub

Sub ShiftRight()
   With Selection
       If (.IndentLevel < 15) Then
           .InsertIndent 1
       Else
           Beep
       End If
   End With
End Sub
Jim Thomlinson - 19 Dec 2005 23:36 GMT
I am assuming that this is a regular workbook and not an addin? Do you have a
class instantiated to catch events. If not then in ThisWorkbook you want

Private Sub Workbook_Open()
   Application.OnKey "%{LEFT}", "ShiftLeft"
   Application.OnKey "%{RIGHT}", "ShiftRight"
End Sub

Signature

HTH...

Jim Thomlinson

> What am I missing? This code is in the "ThisWorkbook" Module; however it
> does not execute ShiftLeft and ShiftRight when the designated keys are
[quoted text clipped - 24 lines]
>     End With
> End Sub
SKRS - 21 Feb 2006 14:10 GMT
hey thr,

this assignment in workbook_open is havin no effect.

Private Sub Workbook_Open()
   MsgBox "open"
   Application.OnKey "{~}", "EnterKey"
End Sub
Sub EnterKey()
   MsgBox "enter key"
   Call ActiveCell.Offset(ActiveSheet.Target.Row + 1,
ActiveSheet.Target.Column)
End Sub

in the above code, enterkey is not being invoked. where should the
application.onKey assignment be done.

appreciate your inputs.

thanks

> I am assuming that this is a regular workbook and not an addin? Do you have a
> class instantiated to catch events. If not then in ThisWorkbook you want
[quoted text clipped - 32 lines]
> >     End With
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.