I am in the middle of converting numerous CorelDRAW-15 GMS files that run in a production setting to CorelDRAW-17. I'm replacing the statement "CorelScript.LoadStyles()" with the code below, but for the statement "Set objStyleSht = New VGCore.StyleSheet" I am getting the error "ActiveX component can't create object". This is basic VBA syntax that should work. Can anyone help?!
'==== NEW CODE ====
Sub CleanMyStyles() Dim objStyleSht As VGCore.StyleSheet Set objStyleSht = New VGCore.StyleSheet objStyleSht.Import "\\{my-server}\{style-sheets}\CORELDRW.cdt", False, True, True, True, FalseEnd Sub
'==================
EXTRA INFORMATION: In CorelDRAW-15 the LoadStyles() function was being used to load a 'clean' CDT file that had very few styles. The cache of loaded styles seemed to get updated resulting in very few styles appearing in the Graphic and Text Styles tool panel. I thought that the code above would be the appropriate way to do this in CorelDRAW-17, but as I said I get the ActiveX error.
ADDITIONAL QUESTION: In CorelDRAW-17 I was able to use the statement "ActiveDocument.LoadStyleSheet()" to load a CDT file. This resulted in a smaller CDR file. Is this an appropriate alternative to CorelDraw-15's "CorelScript.LoadStyles()" function?
Thanks VERY much for any help or advice
Allan Kisner
If the goal is to just clean the styles you could do something like this:
Sub DeleteObjectStyles() Dim d As Document Set d = ActiveDocument Do Until d.StyleSheet.AllStyleSets.Count = 0 d.StyleSheet.AllStyleSets(1).Delete Loop Do Until d.StyleSheet.AllStyles.Count = 0 d.StyleSheet.AllStyles(1).Delete Loop End Sub
Hopefully that helps,
-Shelby