I have a save function, that saves a specific sheet as a tab delimitted text file. The sheet is very hidden and it becomes visible only when saving the file and becomes very hidden once again, but if I abort the process, the file stays visible and that is what I wish to avoid.
Can someone please tell me how can I fix this issue?
Thanks in advance.
This is the code that I am currently using:
Sub save()
Application.DisplayAlerts = False
Sheets("Format3").Visible = True
Sheets("Format3").Select
Sheets("Format3").Copy
New_file = InputBox("Ingrese el nombre del archivo que desea salvar", "Archivo a salvar")
Set File_Dialog = Application.FileDialog(msoFileDialogFolderPicker)
File_Dialog.AllowMultiSelect = False
File_Dialog.Title = "Select the Directory to Save the File"
If File_Dialog.Show <> -1 Then
Exit Sub
End If
'ChDir "D:\"
ActiveWorkbook.SaveAs Filename:=File_Dialog.SelectedItems(1) & "\" & New_file & ".txt", FileFormat:=xlText, _
CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
Sheets("Format3").Visible = xlSheetVeryHidden
End Sub
Can someone please tell me how can I fix this issue?
Thanks in advance.
This is the code that I am currently using:
Sub save()
Application.DisplayAlerts = False
Sheets("Format3").Visible = True
Sheets("Format3").Select
Sheets("Format3").Copy
New_file = InputBox("Ingrese el nombre del archivo que desea salvar", "Archivo a salvar")
Set File_Dialog = Application.FileDialog(msoFileDialogFolderPicker)
File_Dialog.AllowMultiSelect = False
File_Dialog.Title = "Select the Directory to Save the File"
If File_Dialog.Show <> -1 Then
Exit Sub
End If
'ChDir "D:\"
ActiveWorkbook.SaveAs Filename:=File_Dialog.SelectedItems(1) & "\" & New_file & ".txt", FileFormat:=xlText, _
CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
Sheets("Format3").Visible = xlSheetVeryHidden
End Sub