Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Have you tried this : Range("A4").Style="Workbooks("FileName.xla").Style ("myStyle") "Dreiding" a écrit dans le message de groupe de discussion : ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Styles with a S
Range("A4").Style="Workbooks("FileName.xla").Style s("myStyle") |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And watch your double quotes, too.
But even with those corrections, this didn't work for me. michdenis wrote: Styles with a S Range("A4").Style="Workbooks("FileName.xla").Style s("myStyle") -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I did not test. Effectively, it does not work. So, your response is appreciated.
Thanks. "Dave Peterson" a écrit dans le message de groupe de discussion : ... And watch your double quotes, too. But even with those corrections, this didn't work for me. michdenis wrote: Styles with a S Range("A4").Style="Workbooks("FileName.xla").Style s("myStyle") -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#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 . |
Reply |
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 |