Forum Discussion
To prevent file path in Excel VBA
- Jun 30, 2021
Without VBA:
The general storage location can be set in Excel under File / Options / Save (Excel 2016).
With VBA:
Sub Nikolinos_autoSave() Dim Name Name = Application.GetSaveAsFilename("\\MyOwn_nas01\home\Drive\NikolinosPrivatDuc\MUELL\" & Range("B2") & ".xlsm", fileFilter:="Microsoft Excel-Arbeitsmappe (*.xlsm), *.xlsm") 'In GetSaveFilename you have to enter your file path, be careful with the backschlash where it occurs If Name <> False Then ActiveWorkbook.SaveAs Name, FileFormat:= _ xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False End If 'Range("B2") In this cell you can enter the name of the file End Sub
Finally, your file has also been set up as required :)).
Your file, as understandable, could not be tested for the specified path.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
Without VBA:
The general storage location can be set in Excel under File / Options / Save (Excel 2016).
With VBA:
Sub Nikolinos_autoSave()
Dim Name
Name = Application.GetSaveAsFilename("\\MyOwn_nas01\home\Drive\NikolinosPrivatDuc\MUELL\" & Range("B2") & ".xlsm", fileFilter:="Microsoft Excel-Arbeitsmappe (*.xlsm), *.xlsm")
'In GetSaveFilename you have to enter your file path, be careful with the backschlash where it occurs
If Name <> False Then
ActiveWorkbook.SaveAs Name, FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End If
'Range("B2") In this cell you can enter the name of the file
End Sub
Finally, your file has also been set up as required :)).
Your file, as understandable, could not be tested for the specified path.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
- ExcelJun 30, 2021Iron ContributorThank you so much sir😊😊
It helped- NikolinoDEJun 30, 2021Gold Contributoryw