Could someone recover this SWP file for me. I'm running 2013.
Try this one
Thank you Viktor for your help.
use window explorer to copy it to a new one and try open the new one - most of the time, it'll work
That's interesting, I'll have to try that sometime. This rarely happens to me but occasionally I'll have customers who send me corrupt macros and up to this point I have been copying the contents into a fresh macro.
SolidWorks API Training and Services
It happened once a while, working on a macro, closing it and trying to reopen: somehow I got error msg: macro is corrupted and can't be open
I just copied the macro and pasted to a new name and can open it - Not sure it's a SW bug or my code caused it
That never worked for me, so only option was to open in lower version and fix. Though SW2016 SP 4.0 and up, one can fix the macro in the same version of SW.
I've never had this issue since upgrading to 2016 (actually haven't done any macro sine upgrading)
however, I recall one thread discussing about this issue and one application eng. from SW said this has been fixed in SW2016
Here is your macro
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swConfigMgr As SldWorks.ConfigurationManager
Dim swConfig As SldWorks.Configuration
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim nRetVal As Long
Dim vNameArr As Variant
Dim vName As Variant
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swConfigMgr = swModel.ConfigurationManager
Set swConfig = swConfigMgr.ActiveConfiguration
Set swCustPropMgr = swConfig.CustomPropertyManager
' Get all custom properties
vNameArr = swCustPropMgr.GetNames
' If the array has data
If Not IsEmpty(vNameArr) Then
' For Each entry in the configuration names array...
For Each vName In vNameArr
Debug.Print " " & vName & " [" & swCustPropMgr.GetType(vName) & "] = " & swCustPropMgr.Get(vName)
' Change the string to uppercase and save
nRetVal = swCustPropMgr.Set(vName, UCase(swCustPropMgr.Get(vName)))
Set swModel = Nothing
Set swConfigMgr = Nothing
Set swConfig = Nothing
Set swCustPropMgr = Nothing
Set swApp = Nothing
The Obj.. Lib. are all in SW2015 and you are running SW2013 - Make sure to change the obj. lib. - see below image
HI, i have the same problem with a corrupted macro file, can someone of you which have another versión osf the SW help me trying to open it in another versión?
Try if this works.
Here you go !
thank you very much. it works!!!!!!!!!!! and you saved me a lot of time in redoing this.
i haven´t alot of experience in OOP so i struggle a little bit making this kind of tuff from scratch
hello, it's me again. still working on the same macro when suddenly SW crashed. and guess what the macro had been corrupted again!. can you help me... again please? i´ve added some features and bug corrections since the last file
Give this a try.
Retrieving data ...