Modifying Macro to edit whole folder directory

I was linked to this Macro on Solidworks forums that I'm trying to use. I can't seem to get the macro to focus on a full folder or directory rather than the last active file. I have a few other macros that just need you to specify the folder and it opens them automatically, I need this one to do the same.

SolidworksApi macros
Answers 20
DG
DG 2015-12-10 Best Answer

This macro should work fine for files in current directory. So open a file from the directory and then use this macro.

OD
OD 2015-12-10

I guess I'm just confused on how it does that. I created a folder and copied files from our vault to test this on. The Macro doesn't ask you for a location to process multiple files. Instead, the macro will open the last opened document. If you try to run the macro on the document you currently have open, it prompts to close it.

It doesn't affect any other files in the directory for me, just the last document I opened.

AJ
AJ 2015-12-10

Cheers

I've added you a textbox for custom directory. I've tested it. It's working on my end.
Make sure sw is not running low on RAM. According to the API, SldWorks::OpenDoc6 has problem with memory.

comment imagecomment image
OD
OD 2015-12-10

Thanks a ton Amen! But for some reason when I try to run the macro nothing happens. No interface pops up like the old one did. Running the macro from the edit macro window errors "Compile Error: Can't find project or library"

AJ
AJ 2015-12-10

run the sub main from the only module

OD
OD 2015-12-10

I'm running "Main" . I get the same error. It should work like it did before you edited it right? I'm running it the same way. When I run it in the macro editor it prompts me to find available references. Maybe I missing the references I need?

AJ
AJ 2015-12-10

try check the references? im using sw 15 are you using an older version of sw? can you show the references window?

OD
OD 2015-12-10

ohhhh yea I'm working on 2014

OD
OD 2015-12-10

Somehow got it to work by checking and unchecking some of the references. not quite sure how but its working now. Thanks a ton Amen

OD
OD 2015-12-10

I got the interface to show but the process button doesnt work

AJ
AJ 2015-12-10

you need to check  solidworks type library 2014 and uncheck the 2015 version

OD
OD 2015-12-10

Yes, thats how I got it to work. But the Process button once I have all the file editing information set wont work. So the macro never actually starts working on anything

AJ
AJ 2015-12-10

by not working what do you mean?

did you add a rule?
the directory path must not end with \

AJ
AJ 2015-12-10

can you compile step  by step f8 the sub behind the process button?

OD
OD 2015-12-10

Nevermind, I got it. There has to be atleast one part file within the directory you aim the macro to. I didnt go deep enough in the directory for it to work. The macro doesn't see subfolders... This kind of defeats the purpose of the macro though. I need to make changes to a mass amount of files which would require me to select a folder containing folders.

AJ
AJ 2015-12-10

Well, you didn't say that before. I can get you a working version tomorrow if that helps?

OD
OD 2015-12-10

You're right, sorry! That would be awesome Amen. If you have a paypal I can donate for your efforts on this macro, this is very much appreciated

AJ
AJ 2015-12-10

You got it! Send me your e-mail in a private message and I'll get back to you tomorrow (jliliamen@gmail.com)

DG
DG 2015-12-11
<p>Orb D. wrote:</p><p></p><p><span style="font-family: inherit; line-height: 1.5;">If you have a paypal I can donate for your efforts on this macro, this is very much appreciated</span></p>

Sorry for not able to help as my Internet was down since yesterday. And thanks for the appreciation towards on work done by him.

AJ
AJ 2015-12-11

No problem. I got this one Deepak.