Message 1 of 3
Updating Local Styles from Global Styles using VBA

Not applicable
11-28-2007
12:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All
I have tried the following approach, but, it doesn't seem to work ... the SaveToGlobal fails with "Automation error Unspecified error" ... Approach is
1) Activate Drawing Template
2) Save Template Stlyes to Global
3) Activate Drawing
4) Copy Global Styles to the Drawing's Local Styles or Update the Drawing's Local Styles with the Global Styles
Dim oTdoc As Inventor.DrawingDocument --> Template
Dim oTstyle As Inventor.Style
Dim oDoc As Inventor.DrawingDocument --> Drawing
Dim strStyle As String
oTdoc.Activate
strStyle = oTdoc.StylesManager.ActiveStandardStyle.Name --> "StandardStyles"
oTdoc.StylesManager.ActiveStandardStyle.SaveToGlobal --> fails with "Automation error Unspecified error"
oDoc.Activate
If oDoc.StylesManager.StandardStyles(strStyle).InUse = False Then
Set oTstyle = oDoc.StylesManager.ActiveStandardStyle.ConvertToLocal.Copy(strStyle)
Else
oDoc.StylesManager.ActiveStandardStyle.UpdateFromGlobal
End If
Any assistance with this would be terrific ...
I have tried the following approach, but, it doesn't seem to work ... the SaveToGlobal fails with "Automation error Unspecified error" ... Approach is
1) Activate Drawing Template
2) Save Template Stlyes to Global
3) Activate Drawing
4) Copy Global Styles to the Drawing's Local Styles or Update the Drawing's Local Styles with the Global Styles
Dim oTdoc As Inventor.DrawingDocument --> Template
Dim oTstyle As Inventor.Style
Dim oDoc As Inventor.DrawingDocument --> Drawing
Dim strStyle As String
oTdoc.Activate
strStyle = oTdoc.StylesManager.ActiveStandardStyle.Name --> "StandardStyles"
oTdoc.StylesManager.ActiveStandardStyle.SaveToGlobal --> fails with "Automation error Unspecified error"
oDoc.Activate
If oDoc.StylesManager.StandardStyles(strStyle).InUse = False Then
Set oTstyle = oDoc.StylesManager.ActiveStandardStyle.ConvertToLocal.Copy(strStyle)
Else
oDoc.StylesManager.ActiveStandardStyle.UpdateFromGlobal
End If
Any assistance with this would be terrific ...