• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

save a pdf using a "date" value in a cell as a string in my file name

HI there,

I want to use the value of a cell in my spreadsheet to be incorporated as part of my PDF file NAME.
in my sub routine i want to save it in a specific folder starting with the file name as "Remittance date ".... ( and then bring across the date value form the cell , to form part of the name of my file at the end.
I've tried different 'formatting ' option , but my PDF creator does not like what i'm doing
Can u please helP?
Many Thanks
regards , MArtin
 

Attachments

  • CMA Realty LMV Program TEST.xlsm
    763 KB · Views: 2

martinargimon

I had some challenges even open Your file.
I tried to continue anyway.
You wrote something about date ... and ... range("J15").
... Range J15 do not have a date ... Range J14 has
If You tried to have / while You formatted that date then
... it's possible BUT then there have to be many folders ( each date pary needs own folder )
If You format Your date without those / then it works ( or You can use eg - to separate Date - Month and Year )
Here one sample,
but it used fixed my named folder ( I cannot use Your named path )
Ps. There can be some challenges if You try to use long path (as You're using).
 

Attachments

  • martinargimon.xlsb
    755.3 KB · Views: 2
HI vletm,
Thanks for you help.
you are correct is saying that ius cell j14 ( the one with a date, sorry).
So in essence the only thing that i want to do is everytime i save my 'remittance' proof , is to select the range that i wnat to save ( which i've done) , and then just add the name of the file preceeded with the path : ....... and then add the Lease No. as well as the listed in J14..
In this way I will be able to go to the folder "Remittances" and will be able to locate the Remittance by 'Lease no." a well as the date.
What i do not know is the syntax to use to get the PDF writer to save the date in the format listed in j14.
( Not sure if i am making sense).

Code:
WS2.Range("A1:L43").ExportAsFixedFormat xlTypePDF, Filename:= _
"C:\Users\martin argimon\CMA\CMA Realty - Documents\Administration\ICT\Database Program\Remittances Owners\" & "Remittance_Lease No. " & WS2.Range("j15").Value, _
IgnorePrintAreas:=False, Openafterpublish:=True
 

martinargimon

You seem to skip one possible solution...
Code:
& "Remittance_Lease No. " & WS2.Range("j15").Value
Test to change above to
Code:
& "Remittance_Lease No.\" & format(WS2.Range("J14"),"yyyymmdd")
... get possible date.
Your given path do not have Remittances?
Can You find out the real full path - what do You have?
and
What should be after that?
( path to PDF have to be 100% correct )
 
What i do not know is the syntax to use to get the PDF writer to save the date in the format listed in j14.
Hi, just use the cell property Text rather than Value …​
As explained in VBA help - a must read ! - a date cell properties demonstration to try on a blank worksheet :​
Code:
Sub Date4Noob()
   With [D4]
       .NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
       .Value = Date
        MsgBox "Text  :  " & .Text & vbLf & vbLf & "Value  : " & .Value & vbLf & vbLf & "Value2 : " & .Value2, , "D4 properties"
   End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Back
Top