LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
is is is offline
external usenet poster
 
Posts: 2
Default MacroOptions problem

I'm trying to add a keyboard shortcut for a function I have. I have the
following code in the "ThisWorkbook" 'module':

Option Explicit
Const DATECOL As String = "B"

Public Sub FindToday()
' Keyboard Shortcut: Ctrl+T
Dim r As Range

On Error Resume Next
Set r = ThisWorkbook.Worksheets(1).Range(DATECOL & ":" &
DATECOL).Find(what:=Date, LookIn:=xlValues)
If Not r Is Nothing Then
r.Select
End If
ThisWorkbook.Sheets(1).Activate
End Sub

Public Sub Workbook_Open()
Application.MacroOptions Macro:="FindToday", HasShortcutKey:=True,
ShortcutKey:="t"
FindToday

End Sub

I get:

Run-time error "1004":

Method 'MacroOptions' of object '_Application' failed
<<

I've tried all sorts of things (making the routines public, trying
Macro:=ThisWorkbook.Name & "!" & "FindToday", trying it without
assigning the shortcut key - all fail.

Any suggestions, please?!

 
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
Method 'MacroOptions' of object'_Application' failed Runtime Error 1004 EagleOne Excel Discussion (Misc queries) 1 October 22nd 14 05:49 PM
Trouble With MacroOptions Sprinks Excel Programming 2 December 27th 05 05:51 PM
MacroOptions Method Dave Excel Programming 0 November 14th 05 01:07 PM
MacroOptions doesn't stick Greg Lovern[_3_] Excel Programming 5 April 11th 05 06:18 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 10:09 PM.

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

About Us

"It's about Microsoft Excel"