Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
I know how to create and save simple add-ins but this one is a bit more
extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
So what is different from that and a 'normal' addin?
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... I know how to create and save simple add-ins but this one is a bit more extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
This macro that I have created which I was planning to turn into an add-in
consist of parts that are in the workbook, a module, and a class module. I have just tried saving this as a .xla but it does not work when i add it to my add-in list. I am sure it has something to do with the fact that to make this macro work I have code written in the workbook, the module, and the class module. The othe add-ins that i have created just dealt with the modules and was very easy to just save it is a .xla file. Hope that is a better explanation. "Bob Phillips" wrote: So what is different from that and a 'normal' addin? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... I know how to create and save simple add-ins but this one is a bit more extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
Well ALL of the addins that I write have modules, class modules, and
ThisWorkbook code, so it ain't that. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... This macro that I have created which I was planning to turn into an add-in consist of parts that are in the workbook, a module, and a class module. I have just tried saving this as a .xla but it does not work when i add it to my add-in list. I am sure it has something to do with the fact that to make this macro work I have code written in the workbook, the module, and the class module. The othe add-ins that i have created just dealt with the modules and was very easy to just save it is a .xla file. Hope that is a better explanation. "Bob Phillips" wrote: So what is different from that and a 'normal' addin? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... I know how to create and save simple add-ins but this one is a bit more extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
Well the combonation of what I have does not work as an add-in. I may just
not know how to handle the different modules that create this Macro that works and turn it into an add-in. Have you tried taking my code and putting it in your own excel and try what I am having hard time doing?? "Bob Phillips" wrote: Well ALL of the addins that I write have modules, class modules, and ThisWorkbook code, so it ain't that. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... This macro that I have created which I was planning to turn into an add-in consist of parts that are in the workbook, a module, and a class module. I have just tried saving this as a .xla but it does not work when i add it to my add-in list. I am sure it has something to do with the fact that to make this macro work I have code written in the workbook, the module, and the class module. The othe add-ins that i have created just dealt with the modules and was very easy to just save it is a .xla file. Hope that is a better explanation. "Bob Phillips" wrote: So what is different from that and a 'normal' addin? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... I know how to create and save simple add-ins but this one is a bit more extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
I haven't, but it is mostly a case of not referencing the correct workbook.
I will try later if I get a chance. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... Well the combonation of what I have does not work as an add-in. I may just not know how to handle the different modules that create this Macro that works and turn it into an add-in. Have you tried taking my code and putting it in your own excel and try what I am having hard time doing?? "Bob Phillips" wrote: Well ALL of the addins that I write have modules, class modules, and ThisWorkbook code, so it ain't that. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... This macro that I have created which I was planning to turn into an add-in consist of parts that are in the workbook, a module, and a class module. I have just tried saving this as a .xla but it does not work when i add it to my add-in list. I am sure it has something to do with the fact that to make this macro work I have code written in the workbook, the module, and the class module. The othe add-ins that i have created just dealt with the modules and was very easy to just save it is a .xla file. Hope that is a better explanation. "Bob Phillips" wrote: So what is different from that and a 'normal' addin? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... I know how to create and save simple add-ins but this one is a bit more extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
creating an excel add-in
Well I have just tried it.
The big problem was enabling the highlighting. I had to manually run the RowHighlghter procedure so as to get bEnable set. Once I did that it worked. Bit inefficient code, but it worked. You should provide a facility to toggle bEnable. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... Well the combonation of what I have does not work as an add-in. I may just not know how to handle the different modules that create this Macro that works and turn it into an add-in. Have you tried taking my code and putting it in your own excel and try what I am having hard time doing?? "Bob Phillips" wrote: Well ALL of the addins that I write have modules, class modules, and ThisWorkbook code, so it ain't that. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... This macro that I have created which I was planning to turn into an add-in consist of parts that are in the workbook, a module, and a class module. I have just tried saving this as a .xla but it does not work when i add it to my add-in list. I am sure it has something to do with the fact that to make this macro work I have code written in the workbook, the module, and the class module. The othe add-ins that i have created just dealt with the modules and was very easy to just save it is a .xla file. Hope that is a better explanation. "Bob Phillips" wrote: So what is different from that and a 'normal' addin? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "James" wrote in message ... I know how to create and save simple add-ins but this one is a bit more extensive and it involves more than just the regular module. I do not know how to turn this Macro into a add-in or if it is even possible. Any help would be grateful. 'This is the code in the workbook Private Sub Workbook_Open() Call TurnOnEvent End Sub __________________________________________________ __ 'This is the code that is in Module1 Public bEnable As Boolean Dim myobject As New Class1 Sub TurnOnEvent() Set myobject.appevent = Application End Sub Public Sub RowHighlighter() If Not bEnable Then bEnable = True Else bEnable = False End If End Sub __________________________________________________ ______________ 'This is the code that is in the Class Module (Class1) Option Explicit Public WithEvents appevent As Application Private Sub appevent_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) Static Old As Range Static colorindxs(1 To 256) As Long Dim i As Long If bEnable Then If Not Old Is Nothing Then With Old.Cells If .Row = Target.Row Then Exit Sub For i = 1 To 256 .Item(i).Interior.ColorIndex = colorindxs(i) Next i End With End If 'Set Old = Cells(Sh.ActiveCell.Row, 1).Resize(1, 256) Set Old = Cells(Target.Row, 1).Resize(1, 256) With Old For i = 1 To 256 colorindxs(i) = .Item(i).Interior.ColorIndex Next i .Interior.ColorIndex = 36 End With End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating a new chart in Excel | Charts and Charting in Excel | |||
Creating charts in Excel... | Excel Discussion (Misc queries) | |||
Creating an Excel TOC | Excel Worksheet Functions | |||
after creating macro button, closed excel then restarted excel | Excel Discussion (Misc queries) | |||
Creating a US map in Excel | Excel Discussion (Misc queries) |