Страницы: 1
RSS
Удаление книги после открытия, закрытия и отправки по e-mail
 
Доброго времени!

Не подскажете, как в нижеприведенном коде прописать, чтобы по умолчанию открывалась папка "Рабочий стол" и как удалить отправленную книгу после ее открытия, закрытия, отправки по e-mail?
Код
Sub DemoGetOpenFilename()Do
     fName = Application.GetOpenFilename
     Loop Until fName <> False
     Set myBook = Workbooks.Open(Filename:=fName)
'Working in Excel 2010 with Lotus Notes
Dim wb As Workbook
Dim I As Long
Set wb = ActiveWorkbook
If Val(Application.Version) >= 12 Then
If wb.FileFormat = 51 And wb.HasVBProject = True Then
MsgBox "There is VBA code in this xlsx file, there will" & vbNewLine & _
"be no VBA code in the file you send. Save the" & vbNewLine & _
"file first as xlsm and then try the macro again.", vbInformation
Exit Sub
End If
End If
On Error Resume Next
For I = 1 To 3
wb.SendMail "xxxx@xxxx.xx, xxxx@xxxx.xx", _
"Тема письма"
If Err.Number = 0 Then Exit For
Next I
On Error GoTo 0
ActiveWorkbook.Close SaveChanges:=False
End Sub
 
если не ошибаюсь, в самый конец
Код
Kill fName

потренируйтесь на кошках
F1 творит чудеса
 
Спасибо!)
 
"There is VBA code in this xlsx file" - такого не может быть никогда :)
Страницы: 1
Наверх