• 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.

Current date and save to specific folder

Hello,

I'm trying to create a macro that saves current date to a specific folder. I've got the current date part but need to add specific folder. I need to save it to:
I need it to save to
/Users/wesleydewinter/OneDrive/2016 Billing/Daily Fee

The code I have is:

Sub SaveIt()

Dim dt AsString, wbNam AsString

dt = "Daily Fee "

wbNam = Format(CStr(Now), "yyyy_mm_dd ")

ActiveWorkbook.SaveAs Filename:=wbNam & dt

EndSub
 
May be
Code:
Sub SaveIt()
    Dim strpath As String, dt As String, wbNam As String

    strpath = "C:/Users/wesleydewinter/OneDrive/2016 Billing/Daily Fee"
    dt = "Daily Fee "
    wbNam = Format(CStr(Now), "yyyy_mm_dd ")

    ActiveWorkbook.SaveAs Filename:=strpath & wbNam & dt
End Sub
 
I tried it but it came back with this error. I'm using mac OSx that helps at all


Run-time error '1004':

Your changes could not be saved to 'Daily Fee2016_09_06 Daily Fee ', but were saved to a temporary document named 'CA031130'. Close the existing document, then open the temporary document and save it under a new name.
 
Back
Top