I'm not really good in VBA and I would like to know if someone can help me. There is my problem.
I wan't to save as a workbook to a folder but depending of the user, the path changes. So, to solve this issue, I have created this code:
Public Function MyDocsPathS() As String
MyDocsPathS = Environ$("USERPROFILE") & "\" & "OneDrive\Soumission"
End Function
This works well. However I don't know how to write it in the SaveCopyAs function. I have tried this and other ways without any success: (See section between**)
Sub Soumission()
Sheets("Modèle Soumission").Visible = True
**ActiveWorkbook.SaveCopyAs "MyDocsPathS & \S0000x.xlsm"**
Sheets("Modèle Soumission").Visible = False
Workbooks.Open (MyDocsPathS & ("S0000x") & ".xlsm")
End Sub
Thanks for any help!