Macro Question

Louisthefirst

New Member
Joined
Apr 18, 2018
Messages
3
Hi

I was really hoping someone can help me. I currently have a workbook set up that is a purchase order form. This form gets completed and I press the 'Print and Save' Macro which is at the bottom of the form. What this macro does is save the document to a specific folder on the network drive as a PDF and print the document out at the same time. Here is the Macro:


Sub Macro1()
'
' Macro1 Macro
' save as pdf
'

'
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"\\mynetworkdrive.local\DD\DD\Support\HR\Completed Purchase Orders" & Range("G3").Value & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, From:=1, To:=1, OpenAfterPublish:=False
ExecuteExcel4Macro "PRINT(2,1,1,1,,,,,,,,2,,,TRUE,,FALSE)"

End Sub


Now this is all great, but annoying, because I then have to go back to the folder that the PDF was saved to and then move that PDF File to another folder. This other folder is the MONTH in which the excel purchase order was created.

So, what I would LOVE is if I could just point the above macro to check the date cell in the purchase order sheet that I have created (for example, in the purchase order sheet is a cell that has today's date in (F5) written as '18 April 2018' I would like it to read the contents of that date cell (F5) pick up the month of the date and actually save it as a pdf to what ever months folder it is, in this case April. It is worth nothing that the months folders (running from April to March) are located in the same folder as the pdf is saved to so I guess they are sub folders of the original save folder location.

Is this possible to do? If so, can someone help show me the macro to do this so I can just overwrite the old macro with it? (as you can probably tell, I didn't create the last one so really appreciate any help with this)

Thank you in advance
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Try building the string like this:

Code:
"\\mynetworkdrive.local\DD\DD\Support\HR\" & Format(Range("F5").Value, "mmmm") & "\Completed Purchase Orders" & Range("G3").Value & ".pdf"
 
Last edited:
Upvote 0
No. You just replace the part where you built the string in the first macro with this new string.
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,052
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top