Save as pdf with choice of folder

Hello

 

I'm looking for a macro that allows me to save an open drawing in pdf with the choice of the recording folder (if possible, window open with the folder containing "PDF" in its title, this one located above the folder containing the drawing concerned).

Thank you in advance

Hello

Here is a macro that meets your needs.


pdf_dxf_dwg-explo.swp

Or else there is also this one


macro_pdf_enregistrer_sous.swp
1 Like

Hello

There are already a number of them available on the forum, see https://www.lynkoa.com/search/macro%20PDF%20enregistrer%20sous?type[0]=all&pages_search=1 but, be careful, each macro was made to meet a very particular need, the best is to start from an existing macro and adapt it to your needs or to use the task scheduler -> export files to do mass processing in hidden time.

Kind regards

The second one is not bad...

Except that I have to copy and paste the address of the folder to fill in the conversion window....

Knowing that I launch the macro from an open shot....

Is it possible that both boxes are pre-filled... and preferably by the address that corresponds to the file of two levels above the one that contains the drawing concerned, open? 

Or if it's really complicated... at least the address of the folder containing the open drawing, a simple deletion of the last characters will then suffice?

Hello

To be tested and completed with error management etc etc ...

Kind regards


macro_pdf_enregistrer_sous-2.swp
1 Like

Perfect d.roger... Thank you!

Just... How can I go up another level  of file? What stock am I playing on?

Hello

You add the lines:

lgFichier = InStrRev(stpath, "\", -1, vbTextCompare) - 1
If lgFichier > 0 Then
     stpath = Left(stpath, lgFichier)
End If

 after those already existing.

Kind regards

1 Like

All I have to do is add something to put them in dwg as well and it's nikel! I take the lines of another macro?

 

And get pimples... I'll try to find that...

For the macro, be careful to modify it to at least add error handling...

For buttons in Solidworks, see here.

Kind regards

I'm going to tinker but I don't know if I'll succeed.... I'll see

Thanks again

...

To tell the truth... I'm getting a little lost... I wanted to get the name of the mep for the title of the pdf document... but I can't do it...

Then I tried to integrate a macro that does the dwg... but not successful... sniff...

 

So as far as error  management is concerned! not even worth it!

I really struggle with VBA

Here's a macro version that allows you to:

- choose the destination folder for the PDFs (from 3 levels above the SLDDRW).

- save all the sheets of a plan as a PDF.

- choose the destination folder of the DWG (from 3 levels above the SLDDRW).

- Save the plan in DWG.

Kind regards


macro_pdf-dwg_enregistrer_sous.swp
2 Likes

To lift the "sheet number" annotation on the pdf document... What should I delete? Knowing that my plans always have only one sheet, maybe delete the lines that concern the number of sheets?

Hello

You can remove the lines:

vSheets = swModel.GetSheetNames
For i = 1 TB swModel.GetSheetCount
swModel.ActivateSheet vSheets(i - 1)

and:

Next i

to stop browsing all the sheets in the plan and add the line:

swFileName = Left(swFileName, Len(swFileName) - 11)

After the lines:

swModel.ViewZoomtofit2
swFileName = swModel.GetTitle

to remove the sheet number indication.

Kind regards

Perfecto thank you again...