U225X PUBLIC-SAFE CONVERSATION NOTE RECORD: CHAT-0396 TOPIC: VBA Macro Refinement Tips IMPORTED: 2026.04.07 This note was generated from a matching conversation in the supplied ChatGPT export. EXTRACTED REQUEST: Option Explicit Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Sub main() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc If swModel Is Nothing Then MsgBox "No active document." Exit Sub End If If swModel.GetType <> swDocPART Then MsgBox "Run this on a part." Exit Sub End If Dim stockDesc As String Dim stockLen As String Dim flatX As String Dim flatY As String stockDesc = GetProp(swMo RECOVERED CONVERSATION EXCERPTS USER MESSAGES: 1. I have a SolidWorks VBA macro that: - Builds multi-sheet drawings from configurations - Creates process-based sheets (WATER JET, PRESS BRAKE, FINAL PRINT, etc.) - Generates drawing notes per configuration - Uses a drawing template with title block links Current issues: - Sheet title not updating correctly - Notes placement/formatting still slightly off - Extra sheets not deleting reliably - Want notes independent from views (not attached) I already have working code but need refinement, not a rewrite. 2. Option Explicit Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Sub main() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc If swModel Is Nothing Then MsgBox "No active document." Exit Sub End If If swModel.GetType <> swDocPART Then MsgBox "Run this on a part." Exit Sub End If Dim stockDesc As String Dim stockLen As String Dim flatX As String Dim flatY As String stockDesc = GetProp(swModel, "", "STOCK_DESCRIPTION") stockLen = GetProp(swModel, "", "STOCK_LENGTH") flatX = GetProp(swMod… 3. Those ar emy current macros, NOTE_BUILDER and DRAWING_BUILDER also I have attached screen shots from my part of the custom properties and the lst thing I have atttached is a screen shot of my sheet format. 4. Give me the final clean working DRAWING_BUILDER ASSISTANT RESPONSES: 1. Yes — this sounds like a targeted cleanup pass, not a rewrite. From what you described, the problems are probably coming from four specific spots in the macro: 1. Sheet title is being driven by the template/title block, but the sheet isn’t being told which view/config it should pull from. 2. Notes are being inserted while a view is active/selected, so they end up behaving like they belong to the view. 3. Unused sheets are being deleted while the sheet list is changing, which makes deletion unreliable. 4. Note width/wrapping is not being forced after insertion, so long notes keep creeping downward instead of staying in your intended note zone. For title block behavior, SOLIDWORKS drawing sheets can use a specif… 2. Yep — this is definitely a refinement job, not a rewrite. Your title block screenshot shows the sheet header is driven by `$PRPSHEET:"SHEET_TITLE"` and other title block fields are also sheet properties, while your current `DRAWING_BUILDER` is renaming sheets and inserting views but never actually pushing a sheet property value into the drawing sheet itself. At the same time, your `NOTE_BUILDER` writes `DRAWING_NOTE` per configuration and your screenshot shows `SHEET_TITLE` exists in config properties, so the cleanest fix is to keep that workflow and make `DRAWING_BUILDER` copy the config’s `SHEET_TITLE` onto the active drawing sheet when each sheet is built. Your current builder also inserts notes with `Inser… 3. Use this as the full `DRAWING_BUILDER` module. It is built around a 1-sheet drawing template so you do not have to fight leftover unused sheets anymore. [code excerpt omitted] Before you run it, change the template path to your actual new 1-sheet template. EXTRACTED KNOWLEDGE / HOW-TO - Sheet title is being driven by the template/title block, but the sheet isn’t being told which view/config it should pull from. - Notes are being inserted while a view is active/selected, so they end up behaving like they belong to the view. - Unused sheets are being deleted while the sheet list is changing, which makes deletion unreliable. - Note width/wrapping is not being forced after insertion, so long notes keep creeping downward instead of staying in your intended note zone. - Use this pattern after the sheet is created and after the model view for that sheet exists: - Set swSheet = swDraw.GetCurrentSheet - Set swView = swDraw.GetFirstView 'sheet object view - Linked title block note → set `CustomPropertyView` CONVERSATION SHAPE: 23 user turns / 25 assistant turns ATTACHMENTS DETECTED: 99 Raw transcripts, private details, exact locations, account information, employer/customer-confidential material, and restricted software references are not published in this note. PROPERTY OF U225X / PUBLIC-SAFE IMPORT