AnsweredAssumed Answered

Update to Office 2013 has VBA code not working

Question asked by Will Speaker on Dec 28, 2017
Latest reply on Jan 5, 2018 by Ivana Kolin

I'm using VBA to change property fields in a drawing.  I just upgraded my computer which is now running Office 2013 and my code doesn't work anymore.  I get an error message of "Compile error: Can't find project or library" when I try to execute the following code.  Additionally, the text "swCustomInfoText" is highlighted by the debugging program.


Sub ChangeProperties()

Dim swApp, Part As Object

Dim boolstatus, retval As Boolean

Dim swModel As SldWorks.ModelDoc2

Set swApp = CreateObject("sldworks.application")

swApp.Visible = True


FilePath = DirectoryPath & "\" & DrawingFileName

swApp.OpenDoc FilePath, 3

Set Part = swApp.ActiveDoc


retval = Part.DeleteCustomInfo2("", "DrawnDate")

retval = Part.AddCustomInfo3("Default", "DrawnDate", swCustomInfoText, VBA.Format(VBA.Date, "m/d/yy"))


boolstatus = Part.EditRebuild3()


End Sub