Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default using code from an addin

okay, this should be pretty darned simple, but it seems those are always the things that jump up and bite me

i've created a workbook that has 12 modules and 7 user forms. this workbook will be distrubuted to others, so obvioulsy the best thing to do is to make all the code an add in and have some basic workbook and worksheet functions that call the add in code.
i've gotten that far, and added code that successfully adds the add in at the opening of the workbook. but then it says that it can not see any of my add in module names.
am i referencing them incorrectly? this has to be something that is very simple that i am just having a brain hiccup on....

i.e.

Private Sub Worksheet_Change(ByVal Target As Range

AddInWorksheet_Change Targe

End Su

where AddInWorksheet_Change is defined in the addin workbook as a public sub

Public Sub AddInWorksheet_Change(ByVal Target As Range

Dim sCellAddress As Strin
Dim rNew As Rang
Dim rOld As Rang
etc.....

thanks much
heidi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default using code from an addin

Hi Heidi;

If I understand you question correctly you can change the
subs to be public instead of private and that should work.

Thanks,

Greg
-----Original Message-----
okay, this should be pretty darned simple, but it seems

those are always the things that jump up and bite me.

i've created a workbook that has 12 modules and 7 user

forms. this workbook will be distrubuted to others, so
obvioulsy the best thing to do is to make all the code an
add in and have some basic workbook and worksheet
functions that call the add in code.
i've gotten that far, and added code that successfully

adds the add in at the opening of the workbook. but then
it says that it can not see any of my add in module
names.
am i referencing them incorrectly? this has to be

something that is very simple that i am just having a
brain hiccup on.....

i.e.:

Private Sub Worksheet_Change(ByVal Target As Range)

AddInWorksheet_Change Target

End Sub

where AddInWorksheet_Change is defined in the addin

workbook as a public sub:

Public Sub AddInWorksheet_Change(ByVal Target As Range)

Dim sCellAddress As String
Dim rNew As Range
Dim rOld As Range
etc......

thanks much,
heidi
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default using code from an addin

If you create a reference from the workbook to the addin, it should work.

Otherwise, you have to use Application.Run

--
Regards,
Tom Ogilvy

"alfaista" wrote in message
...
okay, this should be pretty darned simple, but it seems those are always

the things that jump up and bite me.

i've created a workbook that has 12 modules and 7 user forms. this

workbook will be distrubuted to others, so obvioulsy the best thing to do is
to make all the code an add in and have some basic workbook and worksheet
functions that call the add in code.
i've gotten that far, and added code that successfully adds the add in at

the opening of the workbook. but then it says that it can not see any of my
add in module names.
am i referencing them incorrectly? this has to be something that is very

simple that i am just having a brain hiccup on.....

i.e.:

Private Sub Worksheet_Change(ByVal Target As Range)

AddInWorksheet_Change Target

End Sub

where AddInWorksheet_Change is defined in the addin workbook as a public

sub:

Public Sub AddInWorksheet_Change(ByVal Target As Range)

Dim sCellAddress As String
Dim rNew As Range
Dim rOld As Range
etc......

thanks much,
heidi



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default using code from an addin

On additional caution. You can't directly show a userform from your
workbook. You would need to call a macro in the addin that shows the
userform or that at least loads it and returns a reference to it.

--
Regards,
Tom Ogilvy

"alfaista" wrote in message
...
okay, this should be pretty darned simple, but it seems those are always

the things that jump up and bite me.

i've created a workbook that has 12 modules and 7 user forms. this

workbook will be distrubuted to others, so obvioulsy the best thing to do is
to make all the code an add in and have some basic workbook and worksheet
functions that call the add in code.
i've gotten that far, and added code that successfully adds the add in at

the opening of the workbook. but then it says that it can not see any of my
add in module names.
am i referencing them incorrectly? this has to be something that is very

simple that i am just having a brain hiccup on.....

i.e.:

Private Sub Worksheet_Change(ByVal Target As Range)

AddInWorksheet_Change Target

End Sub

where AddInWorksheet_Change is defined in the addin workbook as a public

sub:

Public Sub AddInWorksheet_Change(ByVal Target As Range)

Dim sCellAddress As String
Dim rNew As Range
Dim rOld As Range
etc......

thanks much,
heidi



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default using code from an addin

thanks much! i knew i had forgotten something simple. too much of staring at the trees in the forest, so to say
the reference fixed it all up, works like a charm

thanks again


----- Tom Ogilvy wrote: ----

On additional caution. You can't directly show a userform from you
workbook. You would need to call a macro in the addin that shows th
userform or that at least loads it and returns a reference to it

--
Regards
Tom Ogilv

"alfaista" wrote in messag
..
okay, this should be pretty darned simple, but it seems those are alway

the things that jump up and bite me
i've created a workbook that has 12 modules and 7 user forms. thi

workbook will be distrubuted to others, so obvioulsy the best thing to do i
to make all the code an add in and have some basic workbook and workshee
functions that call the add in code
i've gotten that far, and added code that successfully adds the add in a

the opening of the workbook. but then it says that it can not see any of m
add in module names
am i referencing them incorrectly? this has to be something that is ver

simple that i am just having a brain hiccup on....
i.e.
Private Sub Worksheet_Change(ByVal Target As Range
AddInWorksheet_Change Targe
End Su
where AddInWorksheet_Change is defined in the addin workbook as a publi

sub
Public Sub AddInWorksheet_Change(ByVal Target As Range
Dim sCellAddress As Strin

Dim rNew As Rang
Dim rOld As Rang
etc.....
thanks much

heid




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
Reference Addin Module from sheet code zSplash Excel Programming 2 April 19th 04 06:35 PM
Remove Excel AddIn from AddIn List !! Help carl Excel Programming 2 December 8th 03 03:36 PM
Accessing Addin from Sheet_Event Code zSplash Excel Programming 3 December 7th 03 09:52 PM
Accessing Addin from Sheet_Event Code zSplash Excel Programming 0 December 7th 03 05:35 PM
using a function in an addin in my vba code archangel Excel Programming 2 September 6th 03 08:09 AM


All times are GMT +1. The time now is 04:22 AM.

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"