@MaD : Your code works perfectly!
I have an error in the execution of the MACRO:
The result is as follows:
The "description" property does not appear in the PDF file name
for DWGs, (I think it's the result of the error), I'd like to show the names of the sheets (P01, etc.....) at the end.
capture-2.jpg
Indeed, same mistake on your new macro while on the 1st no problems
I see what crashes during my tests it couldn't rename if the file existed so I deleted it but if it doesn't exist it can't delete it I add a file control
With the correction on the line in question
If Len(Dir(Filepath & "\" & Filename & "-" & vSheetNames(i) & ".DWG")) > 0 Then Kill Filepath & "\" & Filename & "-" & vSheetNames(i) & ".DWG"
It should be better:)
macro_export_pdf__dwg.swp
For the property, is it a custom property or the one integrated in Solidworks?
it's a personal property ("DESCRIPTION") of the room (be careful, this property is not in the drawing)
I don't understand much about VBA, but digging into macros that I got back, I wonder if it doesn't correspond to this:
capture-4.jpg
Okay I didn't understand her :/ ok I'm looking
Is there only one component per drawing or several?
Only 1 component per MEP yes
Ok then try this:)
Thank you to our American friends :) https://forum.solidworks.com/message/431752#comment-431752
Macro in PC
macro_export_pdf__dwg.swp
Great it works!!!
Below is the result:
The last little detail:
Once the macro is launched, the PDF opens on the screen. There is no way to close it automatically.
As I want to run the macro in bulk (via the INTEGRATION utility), I wouldn't want to have 10 PDFs open on the screen.
Edit the line
swExportPDFData.ViewPdfAfterSaving = True
in
swExportPDFData.ViewPdfAfterSaving = False
:)
Thank you @Mad for this MACRO.
We have to ask @Clémentine to create a space for us to share MACROS:
Where else Maybe we should put them in the Tutorials?
I'd like to get into VBA too, what do you advise me?
Hello
There are developpez.org with a lot of data on vb/vba. For everything specific to Solidworks, you have to rely on the help of the API available online and from time to time the macro recorder to train yourself.
Super nice MaD!
flegendre/ For the VBA from Solid http://help.solidworks.com/2017/English/api/sldworksapiprogguide/Welcome.htm
Otherwise indeed do not hesitate to search just with the term vba because it has a lot of examples with Excel
Otherwise the one with whom I learned all the basics of Web programming and other the SiteDuZero aka Openclassroom https://openclassrooms.com/old-courses-pdf in the archive there is a very good course on VB.net his teaches a lot of things
Otherwise as Cyril says.f Macro recorder and research:)
A piece of advice is to take the time to comment on these codes, I know I don't do it enough and it's more complicated when you come back six months later on a macro that doesn't work anymore :/
Flegendre & MAX59 Do you have the same need?
Not really a need but always good to take to learn ;-)
@max59,
do you work at VISIATIV?
Are you a Solidworks consultant?