Hey there,
Having a small problem
How to create a new workbook from the template which exist in my current workbook when that template is selected in the ComboBox?
Basically what I need is to be able to save the template as completely new workbook in the destination folder named as invoice number from the named range =_NextInvoice and without any macro in it. Also some cells will only need to be saved as values only and some (those that contain formulas to calculate totals of the invoice) will need to be saved for further use within the new workbook. In addition, How to create link to the new workbook in my existing one so that the new workbook can be accessed via link instead of accessing it directly from within the destination folder?
My code currently letting me to go to the the cell A22 of the template selected in ComboBox, but instead I need to create all above mentioned functionality to be able to do what I really need to do.
Private Sub ContinueButton_Click()
Dim response
Application.ScreenUpdating = 0
Sheets(cmbSheet.Value).Visible = True
directoryPath = getDirectoryPath
'Creating the directory only if it doesn't exist
If Dir(directoryPath, vbDirectory) = "" Then
response = MsgBox("The directory " & Settings.Range("_archiveDir").Value & " does not exist. Would you like to create it?", vbYesNo)
If response = vbYes Then
createDirectory directoryPath
MsgBox "The folder has been created. " & directoryPath
Application.Goto Sheets(cmbSheet.Value).[a22], True
Application.ScreenUpdating = 1
Else
MsgBox "You need to create folder " & Settings.Range("_archiveDir").Value & " to archive your invoices prior to creating them."
Unload Me
End If
Unload Me
ElseIf Dir(directoryPath, vbDirectory) <> directoryPath Then
Application.Goto Sheets(cmbSheet.Value).[a22], True
Application.ScreenUpdating = 1
Unload Me
End If
End Sub
Please help me here
Bookmarks