<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14415&amp;type=atom" />
	<updated>2018-12-24T10:45:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14415</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130554#p130554" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong>, вы немного неправильно подписываетесь на события.<br /></p><div class="codebox"><pre><code>#Persistent
XL := ComObjActive(&quot;Excel.Application&quot;)
Sheet := XL.ActiveSheet
ComObjConnect(Sheet, Worksheet)

class Worksheet {
   Calculate(sheet) {
   If (Sheet.Cells.Range(&quot;J5&quot;).Value = &quot;один&quot;)
     MsgBox Событие
   }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-12-24T10:45:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130554#p130554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130531#p130531" />
			<content type="html"><![CDATA[<p><strong>inseption86</strong>, а куда именно эту строчку добавлять в коде ?</p><p>Добавил строчку в код - вот так.<br />И скрипт вообще перестал реагировать на изменения в ячейке экселя.<br /></p><div class="codebox"><pre><code>
#Persistent
global i := 0
XL := ComObjActive(&quot;Excel.Application&quot;)
Sheet := XL.Workbooks(&quot;1.xls&quot;).Worksheets(&quot;Лист1&quot;)
ComObjConnect(Sheet, Calculate)

   Calculate(cell) {
   	   XL := ComObjActive(&quot;Excel.Application&quot;)
     If (XL.Workbooks(&quot;1.xls&quot;).Worksheets(&quot;Лист1&quot;).Cells(1 ,1).Value = &quot;один&quot;) and (i = 0)
   msgbox Событие
    i := 1
    If (XL.Workbooks(&quot;1.xls&quot;).Worksheets(&quot;Лист1&quot;).Cells(1 ,1).Value = &quot;два&quot;)
      i := 0
   }

</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yl3d]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39558</uri>
			</author>
			<updated>2018-12-22T12:49:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130531#p130531</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130530#p130530" />
			<content type="html"><![CDATA[<p><strong>yl3d</strong></p><div class="codebox"><pre><code>xl.Workbooks(&quot;1.xlsx&quot;).Worksheets(&quot;Лист1&quot;).Cells(1 ,1).select</code></pre></div>]]></content>
			<author>
				<name><![CDATA[inseption86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38818</uri>
			</author>
			<updated>2018-12-22T12:12:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130530#p130530</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130529#p130529" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong>, вот этот вариант работает.</p><p>Подскажите такую вещь.</p><p>Как прописать полный путь ячейки (с учетом листа и книги) ?<br />Книга называется 1.xls, а лист - &quot;Лист1&quot;</p><p>(сейчас стоит Sheet := XL.ActiveSheet , то есть активный лист, а книга вообще не указана)<br />Просто нужно чтобы скрипт как-то находил нужную книгу и лист в ней.</p>]]></content>
			<author>
				<name><![CDATA[yl3d]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39558</uri>
			</author>
			<updated>2018-12-22T11:36:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130529#p130529</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130528#p130528" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#Persistent
global i := 0
XL := ComObjActive(&quot;Excel.Application&quot;)
Sheet := XL.ActiveSheet
ComObjConnect(Sheet, Calculate)

   Calculate(cell) {
   	   XL := ComObjActive(&quot;Excel.Application&quot;)
     If (XL.Range(&quot;J5&quot;).Value = &quot;один&quot;) and (i = 0)
   msgbox Событие
    i := 1
    If (XL.Range(&quot;J5&quot;).Value = &quot;два&quot;)
      i := 0
   }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2018-12-22T06:54:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130528#p130528</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130523#p130523" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong>, ну я скрипт из третьего сообщения кое-как запустил.</p><p>Этот скрипт - работает, но неправильно.<br />Сообщение - должно запускаться только при условии, что в ячейке было какое-то другое слово, а потом оно сменилось на слово &quot;один&quot;.<br />Вот это и есть изменение значения в ячейке.</p><p>А у вас скрипт запускается даже тогда, когда в ячейке изначально было значение &quot;один&quot;, а после пересчета листа - появляется то же самое значение &quot;один&quot;. И скрипт опять срабатывает - выдавая сообщение. Хотя значение - не изменилось.</p>]]></content>
			<author>
				<name><![CDATA[yl3d]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39558</uri>
			</author>
			<updated>2018-12-21T08:55:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130523#p130523</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130520#p130520" />
			<content type="html"><![CDATA[<p>Ну, не знаю, вот, например:<br /></p><div class="codebox"><pre><code>#Persistent
XL := ComObjActive(&quot;Excel.Application&quot;)
Sheet := XL.ActiveSheet
ComObjConnect(Sheet, Worksheet_Events)

class Worksheet_Events {
   Change(cell, sheet) {
      If (cell.address = &quot;$J$5&quot;) and (Sheet.Cells.Range(&quot;J5&quot;).Value = &quot;один&quot;)
       msgbox событие
   }
}</code></pre></div><p>И что, тс будет сам менять формулу на слово &quot;один&quot;.<br />Я так понимаю, формула - это результат каких-то вычислений.</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2018-12-20T23:10:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130520#p130520</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130519#p130519" />
			<content type="html"><![CDATA[<p>У меня эксел не стоит, но мне кажется это неправильным.<br />Ну и отлавливать, мне кажется, надо событие change.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-12-20T22:16:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130519#p130519</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130518#p130518" />
			<content type="html"><![CDATA[<p>У меня только так работает.</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2018-12-20T22:02:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130518#p130518</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130517#p130517" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong>, а зачем вы при отлавливании события заново подключаетесь к экселю?</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-12-20T21:57:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130517#p130517</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130501#p130501" />
			<content type="html"><![CDATA[<p>Это ошибка не ahk, не vba, а com.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-12-20T13:06:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130501#p130501</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130500#p130500" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong> я вроде бы спрашивал про autohotkey, а не про VBA</p>]]></content>
			<author>
				<name><![CDATA[yl3d]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39558</uri>
			</author>
			<updated>2018-12-20T13:04:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130500#p130500</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130499#p130499" />
			<content type="html"><![CDATA[<p><a href="https://support.microsoft.com/en-us/help/238610/getobject-or-getactiveobject-cannot-find-a-running-office-application">https://support.microsoft.com/en-us/hel … pplication</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-12-20T11:32:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130499#p130499</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130497#p130497" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong>, подскажите - почему же появляется такое сообщение об ошибке при работе вашего скрипта ?<br />Выдает эту ошибку - на всех видах экселя.</p><p><a href="https://radikal.ru"><span class="postimg"><img src="https://b.radikal.ru/b19/1812/c2/19fe2f99e65e.jpg" alt="https://b.radikal.ru/b19/1812/c2/19fe2f99e65e.jpg" /></span></a></p>]]></content>
			<author>
				<name><![CDATA[yl3d]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39558</uri>
			</author>
			<updated>2018-12-20T08:22:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130497#p130497</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как скриптом AHK отреагировать на изменение значения ячейки Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130496#p130496" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong>, при чем тут Calculate ?<br />Calculate - это событие для макросов экселя.<br />А я говорю при реакцию на ИЗМЕНЕНИЕ ячейки.<br />Calculate - реагирует не на изменение ячейки, а на ПЕРЕСЧЕТ листа.</p><p>Это значит - сообщение будет выдаваться постоянно при любом пересчете листа, а не в том случае, когда меняется значение ячейки.</p>]]></content>
			<author>
				<name><![CDATA[yl3d]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39558</uri>
			</author>
			<updated>2018-12-20T08:21:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130496#p130496</id>
		</entry>
</feed>
