Reputation: 27
I would like to create a new workbook on a specific directory using a button from an activeworkbook.
Directory will be Drive D:\SALES_RFQ Database
WorkBook name is "M.O Control Number Database"
Condition: The code has to check if the workbook does exists, if not, if has to create the workbook on the given directory.
Any help with much appreciated. Thanks in advance
Upvotes: 0
Views: 10691
Reputation: 8220
Option Explicit
Sub test()
Dim Path As String, DocName As String
Path = "D:\SALES_RFQ Database"
DocName = "M.O Control Number Database"
If Dir(Path & "\" & DocName & ".xlsx") = "" Then
Workbooks.Add
ActiveWorkbook.SaveAs Path & "\" & DocName & ".xlsx"
End If
End Sub
Upvotes: 4