<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; CDO.Message: Отправка файла]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=8090&amp;type=atom" />
	<updated>2013-02-20T09:40:36Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=8090</id>
		<entry>
			<title type="html"><![CDATA[Re: CDO.Message: Отправка файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69657#p69657" />
			<content type="html"><![CDATA[<p><strong>badik</strong><br />Спасибо! Заработало!<br />я и подумать не мог, что это может влиять</p>]]></content>
			<author>
				<name><![CDATA[Домовой]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=28907</uri>
			</author>
			<updated>2013-02-20T09:40:36Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69657#p69657</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CDO.Message: Отправка файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69634#p69634" />
			<content type="html"><![CDATA[<p>Отсутствует тело сообщения<br />&nbsp; &nbsp;<strong> objMessage.Textbody = &quot;mymy&quot;</strong><br />без него размер прикрепленного файла 12 байт </p><div class="codebox"><pre><code>Function CDOMessage(varAddress, objFile)
    Dim objMessage
    Set objMessage = CreateObject(&quot;CDO.Message&quot;)
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;xx.xx.xx.x&quot; &#039;strSmtpServer
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25 &#039; strSmtpPort
    objMessage.BodyPart.Charset =&quot;windows-1251&quot;
    objMessage.Subject = &quot;Мониторинг ПК ПВД&quot;
    objMessage.Textbody = &quot;mymy&quot;
    objMessage.From = &quot;no-reply@xxx.ru&quot;
    objMessage.To = varAddress 
    objMessage.AddAttachment objFile
    objMessage.Configuration.Fields.Update
    objMessage.Send
End Function </code></pre></div>]]></content>
			<author>
				<name><![CDATA[badik]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=21834</uri>
			</author>
			<updated>2013-02-19T12:38:41Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69634#p69634</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CDO.Message: Отправка файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69608#p69608" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Option Explicit

Dim fso
Dim fil
Dim WshShell
Dim CurDir
Dim objExcel
Dim objWorkBook

Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
CurDir=WshShell.CurrentDirectory
Set objExcel = CreateObject(&quot;Excel.Application&quot;) 
Set objWorkBook = objExcel.Workbooks.Open(CurDir &amp; &quot;\MonitorPVD.xlt&quot;)

objExcel.range(&quot;B16&quot;)=&quot;Некоторые данные&quot;
objExcel.range(&quot;B19&quot;)=&quot;Иные данные&quot;
objExcel.DisplayAlerts=False
objExcel.ActiveWorkbook.SaveAs CurDir &amp; &quot;\MonitorPVD.xls&quot;
objExcel.Quit

Set objExcel=Nothing
Set fil=Nothing
Set fso=Nothing
CDOMessage &quot;MyAddress@yyyyy.ru&quot;, CurDir &amp; &quot;\MonitorPVD.xls&quot;

&#039;************************************************************
Function CDOMessage(varAddress, objFile)
    Dim objMessage
    Set objMessage = CreateObject(&quot;CDO.Message&quot;)
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;xx.xx.xx.x&quot; &#039;strSmtpServer
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25 &#039; strSmtpPort
    objMessage.BodyPart.Charset =&quot;windows-1251&quot;
    objMessage.Subject = &quot;Мониторинг ПК ПВД&quot;
    objMessage.From = &quot;no-reply@xxx.ru&quot;
    objMessage.To = varAddress 
    objMessage.AddAttachment objFile
    objMessage.Configuration.Fields.Update
    objMessage.Send
End Function</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Домовой]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=28907</uri>
			</author>
			<updated>2013-02-18T09:13:44Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69608#p69608</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CDO.Message: Отправка файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69605#p69605" />
			<content type="html"><![CDATA[<p><strong>Домовой</strong>, всё-таки покажите, на всякий случай, весь код.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2013-02-18T08:11:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69605#p69605</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CDO.Message: Отправка файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=69603#p69603" />
			<content type="html"><![CDATA[<p>Доброго Всем времени суток!<br />Помогите разобраться с проблемой отправки файла. Есть шаблон Excel. Записываю в него кое-какие данные, сохраняю под новым именем. Отправляю его при помощи CDO.Message<br />Письмо приходит, файл прикреплён, однако открыть его не могу. Вываливается сообщение &quot;Документ поврежден и не может быть открыт&quot;.<br />Процедура отсылки письма<br /></p><div class="codebox"><pre><code>Function CDOMessage(varAddress, strPathFile)
    Dim objMessage
    Set objMessage = CreateObject(&quot;CDO.Message&quot;)
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;xx.xx.xxxx.x&quot; 
    objMessage.Configuration.Fields.Item(&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = xx
    objMessage.BodyPart.Charset =&quot;windows-1251&quot;
    objMessage.Subject = &quot;Мониторинг ПВД&quot;
    objMessage.From = &quot;no-reply@yyyy.ru&quot;
    objMessage.To = varAddress 
    objMessage.AddAttachment strPathFile
    objMessage.Configuration.Fields.Update
    objMessage.Send
End Function
</code></pre></div><p>сам созданный файл прекрасно открывается. объектные переменные уничтожаю ДО отправки письма, т.е. файл ничто не держит...</p><p>Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[Домовой]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=28907</uri>
			</author>
			<updated>2013-02-18T08:02:41Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=69603#p69603</id>
		</entry>
</feed>
