To prevent file path in Excel VBA

Regular Contributor

Hello Everyone,

 

By using save as dialog box, how to prevent user to change the location path with the help of VBA?

 

My Computer location path is - 

E:\PowerPoint

 

Please help..???

 

Here is a attached file...

3 Replies

@Zan_Hanifee 

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.

Thank you so much sir
It helped