U225X PUBLIC-SAFE CONVERSATION NOTE RECORD: CHAT-0122 TOPIC: Copy and Rename Drawings IMPORTED: 2026.02.18 This note was generated from a matching conversation in the supplied ChatGPT export. EXTRACTED REQUEST: Can I wrote a coed for wsolid works to replace all the models in theese new slddrw's with the sldprt that is in the filename RECOVERED CONVERSATION EXCERPTS USER MESSAGES: 1. I need a code that will copy C:\test\test.slddrw 65 times and name each new file per each line in C:\test\test.txt 2. how do I run this 3. can i run it in windows 4. Can I write a code for solid works to replace all the models in these new slddrw's with the sldprt that is in the filename? ASSISTANT RESPONSES: 1. Here’s a simple, clean VBA solution that does exactly what you want: - Takes `C:\test\test.slddrw` - Reads each line from `C:\test\test.txt` - Copies the drawing once per line - Names each new `.slddrw` using the text from that line - Stops automatically when the text file ends (65 lines or any number). 📄 Example `test.txt` [code excerpt omitted] This will create: [code excerpt omitted]. ✅ VBA Code (Copy-Paste Ready) [code excerpt omitted]. ⚠️ Important Notes - Existing files with the same name will cause an error - If needed, I can add auto-overwrite or auto-suffix logic - Works inside or outside SolidWorks - Does not open the files — just copies them (fast). 🔜 Want the Next Step? Since you mentioned automa… 2. You have two easy ways to run it. I’ll show both, starting with the simplest.. ✅ OPTION 1 (RECOMMENDED): Run it from SolidWorks This is best since you’re already working with SolidWorks automation. 1️⃣ Open SolidWorks 2️⃣ Open the VBA Editor - Press `ALT + F11` 3️⃣ Insert a New Module - In the VBA window: - Insert → Module 4️⃣ Paste the Code - Paste the entire macro I gave you into the blank window 5️⃣ Save the Macro - File → Save - Name it something like: [code excerpt omitted] 6️⃣ Run the Macro - Press `F5` - OR click Run ▶ ✅ You should now see 65 new `.slddrw` files in `C:\test\`. 🟡 OPTION 2: Run it Without SolidWorks (Excel VBA) If you just want file copies (no SolidWorks needed): 1️⃣ Open Excel 2️⃣ Open… 3. Yes. In SolidWorks VBA you can batch-open each new .slddrw, look at its filename (ex: `TAG-001.slddrw`), and then replace every referenced model in that drawing with `TAG-001.sldprt` (or `TAG-001.sldasm` if you want), then save + close. Below is a copy/paste-ready SolidWorks macro that: - Loops every `*.slddrw` in a folder - For each drawing: - Builds the target model path from the drawing filename `C:\test\TAG-001.slddrw` → `C:\test\TAG-001.sldprt` - Replaces all referenced documents inside the drawing to that target part - Saves and closes. SolidWorks VBA Macro: Replace referenced models based on filename > Put this in a new SolidWorks VBA macro module. > Update `folderPath` if needed. [code excerpt omitted]… EXTRACTED KNOWLEDGE / HOW-TO - Takes `C:\test\test.slddrw` - Reads each line from `C:\test\test.txt` - Copies the drawing once per line - Names each new `.slddrw` using the text from that line - Stops automatically when the text file ends (65 lines or any number) - -- - Existing files with the same name will cause an error - If needed, I can add auto-overwrite or auto-suffix logic CONVERSATION SHAPE: 6 user turns / 5 assistant turns ATTACHMENTS DETECTED: 7 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