Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default What am I missing?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default What am I missing?

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


--
HTH...

Jim Thomlinson


"keithb" wrote:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default What am I missing?

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


"Jim Thomlinson" wrote:

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


--
HTH...

Jim Thomlinson


"keithb" wrote:

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Who is missing ? lutra Excel Discussion (Misc queries) 6 May 27th 06 09:39 PM
Toolbars Missing, And option to Add Missing SmeetaG Excel Discussion (Misc queries) 3 October 19th 05 11:43 AM
On Error? Creates 1 missing worksheet then never detects any other missing worksheets Craigm[_35_] Excel Programming 2 August 1st 05 02:39 PM
Missing Row Debbie Humphrey Excel Worksheet Functions 3 January 12th 05 06:26 PM
Add-ins missing lrochman Excel Programming 1 October 2nd 03 10:06 PM


All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"