<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS + VBA Запуск макроса в Excel]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5492&amp;type=atom" />
	<updated>2011-02-09T18:30:45Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5492</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS + VBA Запуск макроса в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=45006#p45006" />
			<content type="html"><![CDATA[<p>Спасибо. Вы супер.</p>]]></content>
			<author>
				<name><![CDATA[Mat Skywalker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26275</uri>
			</author>
			<updated>2011-02-09T18:30:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=45006#p45006</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS + VBA Запуск макроса в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=45001#p45001" />
			<content type="html"><![CDATA[<p>Так<br /></p><div class="codebox"><pre><code>Application.VBE.ActiveVBProject.VBComponents(&quot;Module1&quot;).CodeModule.AddFromFile &quot;C:\vba_module.txt&quot;</code></pre></div><p>или вот так<br /></p><div class="codebox"><pre><code>ThisWorkbook.VBProject.VBComponents.Import &quot;C:\vba_module.txt&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Евген]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25253</uri>
			</author>
			<updated>2011-02-09T16:02:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=45001#p45001</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS + VBA Запуск макроса в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=44990#p44990" />
			<content type="html"><![CDATA[<p>Что вроде:</p><div class="codebox"><pre><code>objModule.CodeModule.AddFromFile(&quot;имя и путь к текстовику&quot;)</code></pre></div><p>Так?</p>]]></content>
			<author>
				<name><![CDATA[Mat Skywalker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26275</uri>
			</author>
			<updated>2011-02-08T19:52:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=44990#p44990</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS + VBA Запуск макроса в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=44987#p44987" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Mat Skywalker пишет:</cite><blockquote><p>... как текст VBA кода подгрузить из текстового файла?</p></blockquote></div><p>Используйте метод <strong><span style="color: blue">AddFromFile</span></strong> объекта <span style="color: blue">CodeModule</span></p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2011-02-08T12:33:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=44987#p44987</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS + VBA Запуск макроса в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=44984#p44984" />
			<content type="html"><![CDATA[<p>Внутри скрипта VBS есть вот такой код:</p><div class="codebox"><pre><code>&#039;===================================        
i = objExcel.VBE.ActiveVBProject.VBComponents.Count
objExcel.VBE.ActiveVBProject.VBComponents.Add 1
Set objModule = objExcel.VBE.ActiveVBProject.VBComponents.Item(i + 1)
With objModule.CodeModule
    .InsertLines 1,  &quot;Sub TestSub()&quot;
    .InsertLines 2,  &quot;    Cells.Select&quot;
    .InsertLines 3,  &quot;    Selection.NumberFormat = &quot;&quot;@&quot;&quot;&quot;
    .InsertLines 4,  &quot;    Range(&quot;&quot;A1:Q1&quot;&quot;).Select&quot;
    .InsertLines 5,  &quot;    With Selection&quot;
    .InsertLines 6,  &quot;        .HorizontalAlignment = xlGeneral&quot;
    .InsertLines 7,  &quot;        .VerticalAlignment = xlCenter&quot;
    .InsertLines 8,  &quot;        .WrapText = True&quot;
    .InsertLines 9,  &quot;        .Orientation = 0&quot;
    .InsertLines 10,  &quot;        .AddIndent = False&quot;
    .InsertLines 11,  &quot;        .IndentLevel = 0&quot;
    .InsertLines 12,  &quot;        .ShrinkToFit = False&quot;
    .InsertLines 13,  &quot;        .ReadingOrder = xlContext&quot;
    .InsertLines 14,  &quot;        .MergeCells = False&quot;
    .InsertLines 15,  &quot;    End With&quot;
    .InsertLines 16,  &quot;    Selection.Borders(xlDiagonalDown).LineStyle = xlNone&quot;
    .InsertLines 17,  &quot;    Selection.Borders(xlDiagonalUp).LineStyle = xlNone&quot;
    .InsertLines 18,  &quot;    Selection.Borders(xlEdgeLeft).LineStyle = xlNone&quot;
    .InsertLines 19,  &quot;    Selection.Borders(xlEdgeTop).LineStyle = xlNone&quot;
    .InsertLines 20,  &quot;    With Selection.Borders(xlEdgeBottom)&quot;
    .InsertLines 21,  &quot;        .LineStyle = xlContinuous&quot;
    .InsertLines 22,  &quot;        .ColorIndex = 0&quot;
    .InsertLines 23,  &quot;        .TintAndShade = 0&quot;
    .InsertLines 24,  &quot;        .Weight = xlThin&quot;
    .InsertLines 25,  &quot;    End With&quot;
    .InsertLines 26,  &quot;    Selection.Borders(xlEdgeRight).LineStyle = xlNone&quot;
    .InsertLines 27,  &quot;    Selection.Borders(xlInsideVertical).LineStyle = xlNone&quot;
    .InsertLines 28,  &quot;    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone&quot;
    .InsertLines 29,  &quot;    Range(&quot;&quot;A1&quot;&quot;).Select&quot;
    .InsertLines 30,  &quot;    End Sub&quot;
End With
objExcel.Application.Run &quot;TestSub&quot;
&#039;===================================</code></pre></div><p>Уважаемые, подскажите, как текст VBA кода подгрузить из текстового файла?</p>]]></content>
			<author>
				<name><![CDATA[Mat Skywalker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26275</uri>
			</author>
			<updated>2011-02-08T11:39:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=44984#p44984</id>
		</entry>
</feed>
