Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for this solution. Here's the code I'll be using - maybe.
Sub testme02() ActiveWorkbook.Styles.Merge ThisWorkbook End Sub I will have to call this macro before the styles are used. Which is more efficient - Put an if statement checking if the styles are already merged, or keep executiing testme02? Sub testme03() dim sStyle as string on error resume next sStyle = ActiveWorkbook.Styles("myStyle").Value if sStyle="" then ActiveWorkbook.Styles.Merge ThisWorkbook end if on error goto 0 end sub - Pat "Dave Peterson" wrote: Styles live in workbooks, so you'll have to merge your styles from the addin into the other workbook. Then you can apply that style to any range in the other workbook. I created a style in my "sending" workbook/addin named Test1. Then I could use this code. Option Explicit Sub testme01() Dim FromWkbk As Workbook Dim ToWkbk As Workbook Set FromWkbk = Workbooks("myAddin.xla") Set ToWkbk = Workbooks("book1.xls") ToWkbk.Styles.Merge Workbook:=FromWkbk ToWkbk.Worksheets(1).Range("c3").Style = "test1" End Sub Dreiding wrote: I've created an Add-in to add a worksheet based on user inputs from a form. I use custom style definitions (i.e. Range("A4").Style="myStyle") in my Add-in. Unfortunately Excel errors when trying to execute the code. Is there a way to access the styles defined in the Add-in? Thanks, - Pat -- Dave Peterson . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I save "Data Text to columns" definitions | Excel Discussion (Misc queries) | |||
"Coult not find specified object" and "Path-File access error" messages | Excel Programming | |||
macro command "definitions" | Excel Programming | |||
Problem: Worksheets("New Style 2006").Unprotect Password:="naPrint" | Excel Programming |