ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using code from an addin (https://www.excelbanter.com/excel-programming/296372-using-code-addin.html)

alfaista[_2_]

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

GJones

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
.


Tom Ogilvy

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




Tom Ogilvy

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




alfaista[_2_]

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






All times are GMT +1. The time now is 03:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com