Export PDF to same directory with specific name (in cell) AND save as xlsm with same name as PDF


I have a very specific question. For a file containing price offers I am looking for some help.

For your information:

Cell B6 contains the company name (which will come back later).

I have created a Macro button for exporting a PDF in my generic (empty) price offer file, but it doesn’t cover the whole package. I am looking for the following procedure: with one click on the macro button (which I’ve already created and linked to a module, it has to do the following actions:

– Create a new folder within the same directory (active folder/path, because the path can difer, so I can’t specify the exact path) with the company name (in cell B6), for example “Microsoft Belgium”

– Export the file (only one sheet so nothing special) to PDF with a specific name within that newly created folder: YEARMONTHDATE COMPANY NAME (_ as space is allowed if necessary, company name in cell B6), so for example “20171214 Microsoft Belgium.pdf” of “20171214_MICROSOFT_BELGIUM.pdf” (doesn’t have to be capital letters)

– Save the excel file (as xlsm) with a specific name within that newly created folder (same as above but .xlsm

– If possible (but not necessary), the next time I open the newly saved file in the newly created folder and press the macro button, Excel doesn’t create a new folder, but saves the files within the already created client folder. This might be overkill, but who doesn’t like a challenge 🙂

If all steps can be achieved without a specified path to save, perfect! Otherwise I’ll make sure that there is a specifiek path (f.e. C/documents/offers/…).

Kind regards and thanks in advance!


By: Wim VG

Leave a Reply

Your email address will not be published. Required fields are marked *