Macro doesn't work in other computer

Hello ı wrote a few macro. I am encountering some errors while running them in my colleague computer. ı wrote my codes acording to our standarts (templates file link etc. are in our server). Normally macros are working well. But ıdk why ı am getting strange error. Can some one help me? I can share macro with you if you want to test it.

If you can share the macro code as well as the error, it will help us diagnose what may be happening.

1 Like

Do as @BigCrazyAl was suggesting. Impossible to help solve code issues without being able to reproduce issue locally.

Here 's the first macro (save all sheetmetal in assembly in single file with view) ;

Its some time works sometime not. There are 2 error in this macro;

  1. I am think that ı couldn’t classify view count.Its sometime getting error while nesting view. That’s why am getting error.
  2. As ı typed below ı can’t get flatten pattern view in some part couldn’t. I have to unsuppress flatten.
    https://r1132100503382-eu1-3dswym.3dexperience.3ds.com/?_gl=1*15yg815*_ga*MTAxMDczMTgwNi4xNjQ2OTA1OTEx*_ga_XQJPQWHZHH*MTY3MDk5MjEwNS4xNTkuMS4xNjcwOTkyODYyLjYwLjAuMA#community:yUw32GbYTEqKdgY7-jbZPg/iquestion:FGEy3sMFR_qVcZPx9bOhbw

You still haven’t told us what error message you see. Please remember when asking for coding help on the internet: ALWAYS include your code and ALWAYS include the error message. If you can attach a model, that’s even better.

If your flat pattern macro works on some models but not on all, I suspect that the model is to blame. If an engineer starts messing with the flat pattern configuration and suppresses the wrong feature, it may mess up your models.

The code you posted there only suppresses and unsuppresses features. It does not export anything yet. Are you aware of that? You may also have to suppress a flat pattern feature before unsuppressing the next flat pattern.

Offtopic: wow, 3DX creates terrible links. They are not even recognized as links.

1 Like

Thank for you reply ı solve it. 1. iteration problem 2. feature problem.( you can see in 3DX).

It would be really nice if you can post it here too. Thank you!


Here is the my second question answer;
searchStr = “Flatten”
Action = “Unsuppress” 'Change to “Unsuppress” to unsuppress supressed features
Dim swFeature As SldWorks.Feature
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim featureName As String
Dim supstatus As Boolean
Dim j As Long
j = 1
Set swFeature = swModel.FirstFeature
Do While Not swFeature Is Nothing
’ Get the name of the feature
Let featureName = “Flatten-<EdgeBend” & j & “>1”
If InStr(1, featureName, searchStr, 1) Then
’ Select the feature
supstatus = swModel.Extension.SelectByID2(featureName, “BODYFEATURE”, 0, 0, 0, False, 0, Nothing, 0)
If (Action = “Suppress”) Then
supstatus = swModel.EditSuppress2() ’ Suppress the feature
ElseIf (Action = “Unsuppress”) Then ’
supstatus = swModel.EditUnsuppress2() ’ Unsuppress the feature
End If
End If
Set swFeature = swFeature.GetNextFeature() ’ Get the next feature
j = j + 1
Loop