<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: чтение и редактирование уже открытого документа Excel]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16682&amp;type=atom" />
	<updated>2021-10-28T18:46:21Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16682</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: чтение и редактирование уже открытого документа Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150293#p150293" />
			<content type="html"><![CDATA[<p><strong>inseption86</strong> аа, тут я кое-как уже разобрался что да как. Благо случайно нашел на ютубе видео подходящее, хоть и на английском. Да и <strong>teadrinker</strong> показал другой вариант решения. Но все равно спасибо! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-28T18:46:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150293#p150293</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: чтение и редактирование уже открытого документа Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150290#p150290" />
			<content type="html"><![CDATA[<p><strong>CyberGudini</strong></p><div class="codebox"><pre><code>

book_name := &quot;1.xlsx&quot;

try
{   xl := ComObjActive(&quot;Excel.Application&quot;) 
	book := xl.Workbooks(book_name)

	MyVar := book.worksheets(1).Range(&quot;C4&quot;).Value
	MsgBox % MyVar
	book.worksheets(1).Range(&quot;C5&quot;).Value := &quot;55555&quot;
	MyVar := book.worksheets(1).Range(&quot;C5&quot;).Value
	MsgBox  % MyVar

	book.close(true)
	xl.quit
}
catch
	MsgBox, 262192, , % &quot;Книга &quot;&quot;&quot; book_name &quot;&quot;&quot; не найдена!!&quot;
ExitApp

</code></pre></div>]]></content>
			<author>
				<name><![CDATA[inseption86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38818</uri>
			</author>
			<updated>2021-10-28T18:08:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150290#p150290</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: чтение и редактирование уже открытого документа Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150221#p150221" />
			<content type="html"><![CDATA[<p>Смотрите пример <a href="https://forum.script-coding.com/viewtopic.php?pid=150220#p150220">отсюда</a>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-10-26T21:18:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150221#p150221</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: чтение и редактирование уже открытого документа Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=150219#p150219" />
			<content type="html"><![CDATA[<p>Я нашел код, который может лишь открыть пока еще неоткрытый документ и позволяет читать и редактировать его:<br /></p><div class="codebox"><pre><code>
Path := &quot;D:\Тест\jou.xlsx&quot;
ex := ComObjCreate(&quot;Excel.Application&quot;)
ex.Workbooks.Open(Path)
ex.visible := True

ex:= ComObjActive(&quot;Excel.Application&quot;)
MyVar := ex.Range(&quot;C4&quot;).Value
MsgBox, %MyVar%
ex.Range(&quot;C5&quot;).Value := &quot;55555&quot;
MyVar := ex.Range(&quot;C5&quot;).Value
MsgBox, %MyVar%
</code></pre></div><p>Однако, если я запускаю код при уже открытом документе, он открывает его копию в режиме [только для чтения]. И с каждым новым запуском он открывает копии и так до бесконечности.</p><p>А как сделать, чтобы он не открывал, а например читал и изменял уже открытый документ?<br />вместо </p><div class="codebox"><pre><code>ex.Workbooks.Open(Path)</code></pre></div><p> сделать Что-то вроде: </p><div class="codebox"><pre><code>ex.Workbooks.Read(Path)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[CyberGudini]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42079</uri>
			</author>
			<updated>2021-10-26T21:11:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=150219#p150219</id>
		</entry>
</feed>
