Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Add not compiling

I created an add-in with some basic sub routines. I also have a sub
routine that I am using to assign shortcuts to the other subs.
Sub OnKey()
With Application
..OnKey "+^4", "fmtDollar"
..OnKey "+^5", "fmtPercent"
..OnKey "+^1", "fmtComma"
..OnKey "+^`", "fmtGeneral"
End With
End Sub

The problem is that with the add-in loaded, when I open excel, the
shortcut keys don't work. However, if I go into the code and hit F5 to
compile it and then go back to my worksheet the shortcut keys work
fine.
Any ideas as to why I need to compile this everytime? Any help is
greatly appreciated.

Regards,
Will
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add not compiling

Is there anything in the addin that would make this macro execute when the
addin is loaded. Just like any other workbook, if you want code to run, you
have to trigger it. If you don't, then there's your huckleberry.

--
Regards,
Tom Ogilvy

"will" wrote in message
om...
I created an add-in with some basic sub routines. I also have a sub
routine that I am using to assign shortcuts to the other subs.
Sub OnKey()
With Application
.OnKey "+^4", "fmtDollar"
.OnKey "+^5", "fmtPercent"
.OnKey "+^1", "fmtComma"
.OnKey "+^`", "fmtGeneral"
End With
End Sub

The problem is that with the add-in loaded, when I open excel, the
shortcut keys don't work. However, if I go into the code and hit F5 to
compile it and then go back to my worksheet the shortcut keys work
fine.
Any ideas as to why I need to compile this everytime? Any help is
greatly appreciated.

Regards,
Will



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add not compiling

Seems to me your code (the OnKey... code) is in the wrong place. It'
there but it's not being run until you do it manually. I haven't don
a whole lot of work with addins, but I do believe there should be a wa
to trigget it with the Workbook_Open() event. Check into that and pos
your results. - Piku

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Add not compiling

I used the following to try to get it to "trigger", but it still isn't working.

Private Sub Workbook_Open()
Call OnKey
End Sub

any other ideas?
thx

"Tom Ogilvy" wrote in message ...
Is there anything in the addin that would make this macro execute when the
addin is loaded. Just like any other workbook, if you want code to run, you
have to trigger it. If you don't, then there's your huckleberry.

--
Regards,
Tom Ogilvy

"will" wrote in message
om...
I created an add-in with some basic sub routines. I also have a sub
routine that I am using to assign shortcuts to the other subs.
Sub OnKey()
With Application
.OnKey "+^4", "fmtDollar"
.OnKey "+^5", "fmtPercent"
.OnKey "+^1", "fmtComma"
.OnKey "+^`", "fmtGeneral"
End With
End Sub

The problem is that with the add-in loaded, when I open excel, the
shortcut keys don't work. However, if I go into the code and hit F5 to
compile it and then go back to my worksheet the shortcut keys work
fine.
Any ideas as to why I need to compile this everytime? Any help is
greatly appreciated.

Regards,
Will

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add not compiling

Private Sub Workbook_Open()
With Application
..OnKey "+^4", "fmtDollar"
..OnKey "+^5", "fmtPercent"
..OnKey "+^1", "fmtComma"
..OnKey "+^`", "fmtGeneral"
End With
End Sub

I can't say that naming your procedure ONKEY is the problem, but I would
avoid using that name.

--
Regards,
Tom Ogilvy


"will" wrote in message
m...
I used the following to try to get it to "trigger", but it still isn't

working.

Private Sub Workbook_Open()
Call OnKey
End Sub

any other ideas?
thx

"Tom Ogilvy" wrote in message

...
Is there anything in the addin that would make this macro execute when

the
addin is loaded. Just like any other workbook, if you want code to run,

you
have to trigger it. If you don't, then there's your huckleberry.

--
Regards,
Tom Ogilvy

"will" wrote in message
om...
I created an add-in with some basic sub routines. I also have a sub
routine that I am using to assign shortcuts to the other subs.
Sub OnKey()
With Application
.OnKey "+^4", "fmtDollar"
.OnKey "+^5", "fmtPercent"
.OnKey "+^1", "fmtComma"
.OnKey "+^`", "fmtGeneral"
End With
End Sub

The problem is that with the add-in loaded, when I open excel, the
shortcut keys don't work. However, if I go into the code and hit F5 to
compile it and then go back to my worksheet the shortcut keys work
fine.
Any ideas as to why I need to compile this everytime? Any help is
greatly appreciated.

Regards,
Will



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
Compiling to one sheet Ahern79 Excel Worksheet Functions 2 July 4th 08 10:07 PM
Compiling to one sheet Ahern79 Excel Worksheet Functions 0 July 2nd 08 12:17 AM
Compiling Eddy[_2_] Setting up and Configuration of Excel 1 July 8th 07 04:24 PM
compiling? Jim Carlock[_2_] Excel Programming 3 September 25th 03 03:57 PM
Compiling a workbook... Ted Theodoropoulos Excel Programming 5 July 31st 03 04:05 PM


All times are GMT +1. The time now is 07:53 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"