#1
|
|||
|
|||
Page.SetTheme Method example VBA?
I've inherited a number of multi-page Visio files and want to get them all to use the same Theme (and variations). From the Shape Sheet from the 'one I wish to use as a reference' I can see the Page's "ThemeIndex" value (number) etc. But just can't get it/them to properly apply to a 2nd Visio file, via the Page.SetTheme Method in a VBA macro. PagObj.SetTheme (35) works . It adds the space before the (). Mmm. PagObj.SetTheme (35,2) gets a compile error; syntax error. This is what I want to use (Yes I'm new to Visio VBA) Thanks |
#2
|
||||
|
||||
Visio's VBA is a whole lot of confusion. But recording a macro gives you a few clues to get it working
Code:
Dim aPage As Visio.Page For Each aPage In ActiveDocument.Pages aPage.SetTheme 35 aPage.SetThemeVariant 2, 2 Next aPage
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Hi Andrew,
Wow, thanks very much, that worked. I had tried to record a Macro, but was over-thinking it and recording it whilst editing the Page's Shape Sheet values. It is confusing as the MS website has the brackets (), like a function. Code:
expression . SetTheme(varThemeIndex,varColorScheme,varEffectScheme,varConnectorScheme,varFontScheme) expression A variable that represents a Page object. |
#4
|
||||
|
||||
No you read it correctly but as I said, Visio's VBA doesn't make a great deal of sense. When I recorded it saved the theme as
.SetTheme 35, 35, 35, 35, 35 which is plainly stupid but most of those variables are optional so I removed them to make it simpler In VBA, the brackets are optional unless you are trying to set a variable at the same time eg Set aDoc = Documents.Add(sPath) vs Documents.Add sPath
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sorting method | Steve Bartko | Excel | 6 | 10-26-2016 11:38 AM |
Why no 'SaveCopyAs' method? | Cosmo | Word VBA | 4 | 10-18-2013 05:57 AM |
Creating a sorting method. | Balliol | Word | 2 | 07-25-2013 06:18 AM |
Shared Contacts & Calendars. Best method | crobertson | Outlook | 1 | 05-08-2009 05:47 AM |
Retrict Method Condition | markp | Outlook | 0 | 12-22-2005 05:38 PM |