trouble with creating styles via vba

  • Thread starter deniskrizanovic
  • Start date
D

deniskrizanovic

I have the following code which succesfully creates the style, but
doesn't seem to create the fills at all. Am I doing something wrong
with the scope?



Dim UndoScopeID1 As Long
Dim vsoStyle1 As Visio.Style

Application.ActiveDocument.Styles.Add "dk3", "Normal", False,
False, True
Set vsoStyle1 = Application.ActiveDocument.Styles.ItemFromID(8)

UndoScopeID1 = Application.BeginUndoScope("Fill Properties")
Debug.Print vsoStyle1.Name
vsoStyle1.CellsSRC(visSectionObject, visRowFill,
visFillForegnd).FormulaU = RGB(202, 152, 0)
vsoStyle1.CellsSRC(visSectionObject, visRowFill,
visFillForegndTrans).FormulaU = 30
vsoStyle1.CellsSRC(visSectionObject, visRowFill,
visFillBkgndTrans).FormulaU = 30
Application.EndUndoScope UndoScopeID1, True
 
M

Mark Nelson [MS]

I would wrap the values you assign to FormulaU in quotes. You need to put
the RGB formula itself into the cell, not the result of the VBA function for
RGB.
 
Top