Hey All,
Maybe I don't know enough about VBA to understand this, but how can a boolean be both true and false at the same time??
Looking at the code snippet below, bExportComplete is a boolean.
It gets set to True by the default ITableAnnotations::SaveAsText member.
But somehow manages to run both the True and "Not" True If statements??
It both sends a message to the user, and deletes the BOM...
If I manually set the bExportComplete to either True or False (using the commented out line), it works as it's suppose to.
If I only use the return value from SaveAsText I end up running both... Does anyone know much about this function that could explain it?
--Snippet---
'Save Standard Table
bExportComplete = swTableAnn.SaveAsText(CsvFileName, "~")
Debug.Print (" --File Save Result is: " & bExportComplete)
' bExportComplete = False '(Debug Message/Delete)
If Not bExportComplete Then
Debug.Print ("Failed to Complete, send message to user? Why do both of these sections run????")
Application.SldWorks.SendMsgToUser ("CSV File failed to save." & Chr(13) & Chr(10) & "Try a manual save-as of BOM in lower left corner.")
End If
If bExportComplete Then
' Delete BOM
' Convert BOM to Feature and Select it
Debug.Print ("Deleting BOM ... ");
StatusBarMsg ("Deleting BOM")
Set swFeat = swBOMTable.BomFeature.GetFeature
bRet = swFeat.Select2(False, 0)
Debug.Print ("BOM Name/ID is: '" & swFeat.Name & "' / '" & swFeat.GetID & "' ... ");
'And Delete
swDoc.DeleteSelection (True)
Debug.Print ("' completed")
End If
--EndSnippet---
My Debug output looks as follows:
--File Save Result is: True
Failed to Complete, send message to user? Why do both of these sections run????
Deleting BOM ... BOM Name/ID is: 'Bill of Materials53' / '6235' ... ' completed
It's mind boggling to me.
Thanks in advance for any insight or clarification.
SolidworksApi macros