[Solved] save it and set path

reza_akbar

New member
Code:
Sub SaveIt()
Dim dt As String, wbNam As String

wbNam = "Log book"
dt = Format(CStr(Now), "yyyy_mm_dd_hh_mm")
ActiveWorkbook.SaveAs Filename:=wbNam & dt
End Sub

how to make save in set path, like D:\file magang\hasil magang vba
 
Dear reza_akbar,

To save the file in a specific path, you must include the folder path, file name, and extension in the Filename argument of the SaveAs method. The modified code is given below:

Code:
Sub SaveIt()
    Dim dt As String, wbNam As String, savePath As String
    'Enter your workbook name
    wbNam = "Log book"
    dt = Format(CStr(Now), "yyyy_mm_dd_hh_mm")
    'Enter your required file path
    savePath = "D:\file magang\hasil magang vba\" & wbNam & dt & ".xlsm"
    ActiveWorkbook.SaveAs Filename:=savePath
End Sub

I hope this resolves your problem. Let us know your feedback.

Regards,
Seemanto Saha
ExcelDemy
 

Online statistics

Members online
0
Guests online
8
Total visitors
8

Forum statistics

Threads
287
Messages
1,240
Members
508
Latest member
HaroldDyeme
Top