Forum Discussion
wb.SaveAs CurrentProject.Path & nomefile
- Mar 05, 2022
if you keep on encountering error when using SaveAs...
you might as well revised the step of Creating workbook from your Template:
1. Create the "work" workbook from your template first:
VBA.FileCopy CurrentProject.Path & "\modello DDT.xlsx", CurrentProject.Path & "\" & nomefile
now directly open the nomefile and update it:
Set wb = ex.Workbooks.Open(CurrentProject.Path & "\" & nomefile)
'seleziona il foglio 1
Set ws = wb.Worksheets("RIGHE DOCUMENTO")'rest of code here
...
...
'Close and Save changes
wb.Close, True
if you keep on encountering error when using SaveAs...
you might as well revised the step of Creating workbook from your Template:
1. Create the "work" workbook from your template first:
VBA.FileCopy CurrentProject.Path & "\modello DDT.xlsx", CurrentProject.Path & "\" & nomefile
now directly open the nomefile and update it:
Set wb = ex.Workbooks.Open(CurrentProject.Path & "\" & nomefile)
'seleziona il foglio 1
Set ws = wb.Worksheets("RIGHE DOCUMENTO")
'rest of code here
...
...
'Close and Save changes
wb.Close, True
Grazie della tua disponibilità e della tua competenza
Gianmario