Running a Macro with file converter

I have noticed the increasing file size of my projects over the past couple months and have found that there are many unused symbols lurking in the files. I have a vba macro to delete unused symbols from a file, but am looking to have that macro run when a file is opened. I figure if I can get this set up I can run file converter on the ~1000 files that need to have the symbols removed. Can anyone help with vba to run the macro on open and close the file after? The code I am using now is

Sub delete()

Dim i As Integer

On Error Resume Next
For i = ActiveDocument.SymbolLibrary.Symbols.Count To 1 Step -1
ActiveDocument.SymbolLibrary.Symbols.Item(i).delete
Next i
On Error GoTo 0
End Sub

Parents
  • Open macro editor.

    double-click GlobalMacros (GlobalMacros.gms).

    double-click CorelDRAW X6 Objects

    double click ThisMacroStorage.

    Left drop down choose GlobalMacroStorage.

    Right drop down choose DocumentOpen.

    Drop your code in between the tags.

    Add another for close as necessary

    Test before choosing to save in edito

Reply Children