- Codice: Seleziona tutto
Sub CreaCartella()
Dim Cartella As String
Dim FileSystemObj
Set FileSystemObj = CreateObject("Scripting.FileSystemObject")
If Sheets("account").Range("B5") = "" Then
Cartella = "C:\" & Sheets("account").Range("B4")
If Not FileSystemObj.folderExists(Cartella) Then
FileSystemObj.CreateFolder Cartella
MsgBox "Attenzione: E' stata creata la nuova Cartella " & Sheets("account").Range("B4") & " nella Directory C:\", vbInformation, "Avviso"
Else
MsgBox "Attenzione: La Cartella " & Sheets("account").Range("B4") & " esiste già!", vbExclamation, "AVVISO"
End If
Sheets("account").Range("B5").Value = "X"
End If
Nomefile = Sheets("account").Range("B3")
Path = "C:\" & Sheets("account").Range("B4") & "\"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Path & Sheets("account").Range("B3") & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveWorkbook.Save
MsgBox "File " & Sheets("account").Range("B3") & " è stato salvato", vbInformation, "AVVISO"
End Sub
La prima volta ha funzionato bene, poi arrivando al punto in cui si salva il file ( questo punto ActiveWorkbook.SaveAs...ecc ecc ) mi restituisce un'errore, riuscite a vedere dove sbaglio?
Allego file http://www.filedropper.com/file1_5
Grazie e buonanotte!