ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook with no code now ... will need macro functionality later (https://www.excelbanter.com/excel-programming/418967-workbook-no-code-now-will-need-macro-functionality-later.html)

Barb Reinhardt

Workbook with no code now ... will need macro functionality later
 
I'm working with a group that has vanilla flavored workbook (no code) that
they want to deploy. At some time in the future, they want to be able to
add code to that workbook.

The options I can come up with a

1) Use functionality such the stuff on Chips site about Programming in the
VBA editor to add the code to the now vanilla workbook. The problem I can
forsee is that the macros would still need to be enabled each time the
workbook is opened. I don't want to recommend that people set their
security to LOW. We're looking at digital signatures as well, but as I
understand it the code would need to be signed after it's in the workbook and
I"m guessing that can't be done programmatically.

2) Put the code in an Add-In that's distributed later. I've only done
this once and had to select a referece to the Add-in in the VBE. I'm
thinking that we can decide on the name for the Add-in now and set the
reference to it. When the add-in is deployed, the reference will already be
set and it'll be ready to go.

Comments/Suggestions. Am I completely on the wrong track?

Thanks,
Barb Reinhardt


Barb Reinhardt

Workbook with no code now ... will need macro functionality later
 
I'm also considering doing something like a Compare add-in I picked up
somewhere. When the add-in is enabled, something is added to the Tools menu
for execution. I'm thinking that when we move to Office 2007, this will be
in an XLAM and I'll have to convert. OK, I know I've asked too many
questions for one thread so will stop for now.

Barb Reinhardt

"Barb Reinhardt" wrote:

I'm working with a group that has vanilla flavored workbook (no code) that
they want to deploy. At some time in the future, they want to be able to
add code to that workbook.

The options I can come up with a

1) Use functionality such the stuff on Chips site about Programming in the
VBA editor to add the code to the now vanilla workbook. The problem I can
forsee is that the macros would still need to be enabled each time the
workbook is opened. I don't want to recommend that people set their
security to LOW. We're looking at digital signatures as well, but as I
understand it the code would need to be signed after it's in the workbook and
I"m guessing that can't be done programmatically.

2) Put the code in an Add-In that's distributed later. I've only done
this once and had to select a referece to the Add-in in the VBE. I'm
thinking that we can decide on the name for the Add-in now and set the
reference to it. When the add-in is deployed, the reference will already be
set and it'll be ready to go.

Comments/Suggestions. Am I completely on the wrong track?

Thanks,
Barb Reinhardt


Peter T

Workbook with no code now ... will need macro functionality later
 
I would go with your idea putting all your code in an addin. Not why sure
you would need any references at all (I assume you are talking about Tools,
Ref's). Only reason to do that is to be able to call code in the referenced
workbook as if it is in the same workbook; presumably that scenario would
not exist if there is no code in the deployed workbooks.

You can trap events of any or all open workbooks at sheet or workbook level
from within your addin (in addition to application level events), if that's
an objective.

Regards,
Peter T


"Barb Reinhardt" wrote in message
...
I'm working with a group that has vanilla flavored workbook (no code) that
they want to deploy. At some time in the future, they want to be able to
add code to that workbook.

The options I can come up with a

1) Use functionality such the stuff on Chips site about Programming in
the
VBA editor to add the code to the now vanilla workbook. The problem I
can
forsee is that the macros would still need to be enabled each time the
workbook is opened. I don't want to recommend that people set their
security to LOW. We're looking at digital signatures as well, but as I
understand it the code would need to be signed after it's in the workbook
and
I"m guessing that can't be done programmatically.

2) Put the code in an Add-In that's distributed later. I've only done
this once and had to select a referece to the Add-in in the VBE. I'm
thinking that we can decide on the name for the Add-in now and set the
reference to it. When the add-in is deployed, the reference will already
be
set and it'll be ready to go.

Comments/Suggestions. Am I completely on the wrong track?

Thanks,
Barb Reinhardt




Barb Reinhardt

Workbook with no code now ... will need macro functionality la
 
I'm familiar with workbook events in a specific workbook. Can you direct me
to how I'd do that with an Add-In?

Thanks,
Barb Reinhardt

"Peter T" wrote:

I would go with your idea putting all your code in an addin. Not why sure
you would need any references at all (I assume you are talking about Tools,
Ref's). Only reason to do that is to be able to call code in the referenced
workbook as if it is in the same workbook; presumably that scenario would
not exist if there is no code in the deployed workbooks.

You can trap events of any or all open workbooks at sheet or workbook level
from within your addin (in addition to application level events), if that's
an objective.

Regards,
Peter T


"Barb Reinhardt" wrote in message
...
I'm working with a group that has vanilla flavored workbook (no code) that
they want to deploy. At some time in the future, they want to be able to
add code to that workbook.

The options I can come up with a

1) Use functionality such the stuff on Chips site about Programming in
the
VBA editor to add the code to the now vanilla workbook. The problem I
can
forsee is that the macros would still need to be enabled each time the
workbook is opened. I don't want to recommend that people set their
security to LOW. We're looking at digital signatures as well, but as I
understand it the code would need to be signed after it's in the workbook
and
I"m guessing that can't be done programmatically.

2) Put the code in an Add-In that's distributed later. I've only done
this once and had to select a referece to the Add-in in the VBE. I'm
thinking that we can decide on the name for the Add-in now and set the
reference to it. When the add-in is deployed, the reference will already
be
set and it'll be ready to go.

Comments/Suggestions. Am I completely on the wrong track?

Thanks,
Barb Reinhardt





Peter T

Workbook with no code now ... will need macro functionality la
 
Following into a normal module and two class modules. Run "Trapem". Switch
between workbooks and select cells. the application level class will trap
all events, the workbook level class just thos in Book1.xls

'' normal module

Dim mAppEvnts As clsApp

Dim mWbEvnts As clsWB

Sub Trapem()

Set mAppEvnts = New clsApp
Set mAppEvnts.xlApp = Application

Set mWbEvnts = New clsWB
Set mWbEvnts.pWb = Workbooks("Book1.xls") ' some other book

End Sub

'' end normal module


' Class module named clsApp

' Application level events
Public WithEvents xlApp As Excel.Application

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
MsgBox Target.Address(external:=True), , "xlApp_SheetSelectionChange"
End Sub

' in the upper left combo select "xlApp"
' in the upper right dropdown select events


Private Sub xlApp_WorkbookActivate(ByVal Wb As Workbook)

MsgBox Wb.Name, , "xlApp_WorkbookActivate"

' maybe go on to create a withevents class to trap Wb's events
' at Workbook level
End Sub

'' end clsApp


' Class module named clsWb

' Workbook level events
Public WithEvents pWb As Excel.Workbook

' in the upper left combo select "pWb"
' in the upper right dropdown select events

Private Sub pWb_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
MsgBox Target(1).Address(external:=True), , "pWb_SheetSelectionChange"
End Sub

'' end clsWb


You would only have one instance of application level events but you could
have multiple withevents classes to trap workbook events. Rather than the
single object ref to the class "mWbEvnts" the ref's could be held in a
collection or array.

Regards,
Peter T



"Barb Reinhardt" wrote in message
...
I'm familiar with workbook events in a specific workbook. Can you direct
me
to how I'd do that with an Add-In?

Thanks,
Barb Reinhardt

"Peter T" wrote:

I would go with your idea putting all your code in an addin. Not why sure
you would need any references at all (I assume you are talking about
Tools,
Ref's). Only reason to do that is to be able to call code in the
referenced
workbook as if it is in the same workbook; presumably that scenario would
not exist if there is no code in the deployed workbooks.

You can trap events of any or all open workbooks at sheet or workbook
level
from within your addin (in addition to application level events), if
that's
an objective.

Regards,
Peter T


"Barb Reinhardt" wrote in
message
...
I'm working with a group that has vanilla flavored workbook (no code)
that
they want to deploy. At some time in the future, they want to be able
to
add code to that workbook.

The options I can come up with a

1) Use functionality such the stuff on Chips site about Programming
in
the
VBA editor to add the code to the now vanilla workbook. The problem I
can
forsee is that the macros would still need to be enabled each time the
workbook is opened. I don't want to recommend that people set their
security to LOW. We're looking at digital signatures as well, but as
I
understand it the code would need to be signed after it's in the
workbook
and
I"m guessing that can't be done programmatically.

2) Put the code in an Add-In that's distributed later. I've only
done
this once and had to select a referece to the Add-in in the VBE. I'm
thinking that we can decide on the name for the Add-in now and set the
reference to it. When the add-in is deployed, the reference will
already
be
set and it'll be ready to go.

Comments/Suggestions. Am I completely on the wrong track?

Thanks,
Barb Reinhardt








All times are GMT +1. The time now is 08:13 PM.

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