<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Laurens Van Keer</title>
	<atom:link href="http://laurens.vankeer.eu/comments/feed" rel="self" type="application/rss+xml" />
	<link>http://laurens.vankeer.eu</link>
	<description>Laurens.VanKeer.eu</description>
	<lastBuildDate>Mon, 11 Aug 2008 12:21:05 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on [update] Excel 2 AS/400 by Manoel Fernandes</title>
		<link>http://laurens.vankeer.eu/scripting/excel-2-as400-update/comment-page-1#comment-5</link>
		<dc:creator>Manoel Fernandes</dc:creator>
		<pubDate>Mon, 11 Aug 2008 12:21:05 +0000</pubDate>
		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=9#comment-5</guid>
		<description>Dear Laurens,

Thanks a lot. The aid was very good.

Manoel Fernandes (I´m from Brasil)</description>
		<content:encoded><![CDATA[<p>Dear Laurens,</p>
<p>Thanks a lot. The aid was very good.</p>
<p>Manoel Fernandes (I´m from Brasil)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on [update] Excel 2 AS/400 by Laurens</title>
		<link>http://laurens.vankeer.eu/scripting/excel-2-as400-update/comment-page-1#comment-4</link>
		<dc:creator>Laurens</dc:creator>
		<pubDate>Sat, 09 Aug 2008 09:21:18 +0000</pubDate>
		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=9#comment-4</guid>
		<description>Hi Raimundo,

Thank you for your response.
I assume you mean sending data from an AS/400 client access emulator (like IBM Personal Communications) to an Excel spreadsheet, using a macro.
I also assume you know some basic VBScript to write macro&#039;s. If not, check out http://www.w3schools.com/vbscript/default.asp.

To send data from an AS/400 terminal screen to an Excel sheet, you basically need to use only two functions from that template macro:

&lt;pre lang=&quot;vb&quot; line=&quot;1&quot;&gt;
Function GetText(ByVal row, ByVal column, ByVal length)
	autECLSession.autECLOIA.WaitForAppAvailable
	autECLSession.autECLOIA.WaitForInputReady
	GetText = Trim(autECLSession.autECLPS.GetText(row, column, length))
End Function
&lt;/pre&gt;

and

&lt;pre lang=&quot;vb&quot; line=&quot;1&quot;&gt;
Function SetCellData(ByVal row, ByVal column, ByVal cellValue)
	ObjWorksheet.Cells(row, column).Value = cellValue
End Function
&lt;/pre&gt;

E.g. if you want to send the text from 10/20 to 10/30 in the AS/400 emulator to cell D2 (= row 2, column 4) in your Excel sheet, you could add the following code to the &quot;Main&quot; subroutine (if your macro has the same layout as my template):

&lt;pre lang=&quot;vb&quot; line=&quot;1&quot;&gt;
&#039; ... [ your code ] ...
Sub Main()
 
	&#039; ... [ your code ] ...
	If IsCorrectSheet() Then	
	
		&#039; ... [ your code ] ...

		var lineText = GetText(10, 20, 10)
		SetCellData 2, 4, lineText

		&#039; or simply:
		&#039; SetCellData 2, 4, GetText(10, 20, 10)
		&#039; should work too.

		&#039; ... [ more code ] ... 
	
	Else
		Msgbox &quot;Excel sheet doesn&#039;t have a valid format.&quot;
	End If
 
	&#039; Save the workbook.
	ObjExcelAppl.ActiveWorkbook.Save
	ObjExcelAppl.DisplayAlerts = True
 
End sub
&#039; ... [ your code ] ...
&lt;/pre&gt;

That&#039;s all actually. Just make sure the objects &quot;ObjExcelAppl&quot;, &quot;ObjWorkbook&quot; and &quot;ObjWorksheet&quot; are set, but if you copy-paste my template and customize it to your needs, that shouldn&#039;t be a problem.

Best regards,

Laurens</description>
		<content:encoded><![CDATA[<p>Hi Raimundo,</p>
<p>Thank you for your response.<br />
I assume you mean sending data from an AS/400 client access emulator (like IBM Personal Communications) to an Excel spreadsheet, using a macro.<br />
I also assume you know some basic VBScript to write macro&#8217;s. If not, check out <a href="http://www.w3schools.com/vbscript/default.asp" rel="nofollow">http://www.w3schools.com/vbscript/default.asp</a>.</p>
<p>To send data from an AS/400 terminal screen to an Excel sheet, you basically need to use only two functions from that template macro:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> GetText(<span style="color: #000080;">ByVal</span> row, <span style="color: #000080;">ByVal</span> column, <span style="color: #000080;">ByVal</span> length)
	autECLSession.autECLOIA.WaitForAppAvailable
	autECLSession.autECLOIA.WaitForInputReady
	GetText = Trim(autECLSession.autECLPS.GetText(row, column, length))
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></td></tr></table></div>

<p>and</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> SetCellData(<span style="color: #000080;">ByVal</span> row, <span style="color: #000080;">ByVal</span> column, <span style="color: #000080;">ByVal</span> cellValue)
	ObjWorksheet.Cells(row, column).Value = cellValue
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></td></tr></table></div>

<p>E.g. if you want to send the text from 10/20 to 10/30 in the AS/400 emulator to cell D2 (= row 2, column 4) in your Excel sheet, you could add the following code to the &#8220;Main&#8221; subroutine (if your macro has the same layout as my template):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">' ... [ your code ] ...
</span><span style="color: #000080;">Sub</span> Main()
&nbsp;
	<span style="color: #008000;">' ... [ your code ] ...
</span>	<span style="color: #000080;">If</span> IsCorrectSheet() <span style="color: #000080;">Then</span>	
&nbsp;
		<span style="color: #008000;">' ... [ your code ] ...
</span>
		var lineText = GetText(10, 20, 10)
		SetCellData 2, 4, lineText
&nbsp;
		<span style="color: #008000;">' or simply:
</span>		<span style="color: #008000;">' SetCellData 2, 4, GetText(10, 20, 10)
</span>		<span style="color: #008000;">' should work too.
</span>
		<span style="color: #008000;">' ... [ more code ] ... 
</span>	
	<span style="color: #000080;">Else</span>
		Msgbox &quot;Excel sheet doesn<span style="color: #008000;">'t have a valid format.&quot;
</span>	<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
	<span style="color: #008000;">' Save the workbook.
</span>	ObjExcelAppl.ActiveWorkbook.Save
	ObjExcelAppl.DisplayAlerts = <span style="color: #000080;">True</span>
&nbsp;
<span style="color: #000080;">End</span> <span style="color: #000080;">sub</span>
' ... [ your code ] ...</pre></td></tr></table></div>

<p>That&#8217;s all actually. Just make sure the objects &#8220;ObjExcelAppl&#8221;, &#8220;ObjWorkbook&#8221; and &#8220;ObjWorksheet&#8221; are set, but if you copy-paste my template and customize it to your needs, that shouldn&#8217;t be a problem.</p>
<p>Best regards,</p>
<p>Laurens</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on [update] Excel 2 AS/400 by Manoel Fernandes</title>
		<link>http://laurens.vankeer.eu/scripting/excel-2-as400-update/comment-page-1#comment-3</link>
		<dc:creator>Manoel Fernandes</dc:creator>
		<pubDate>Fri, 08 Aug 2008 20:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://laurens.vankeer.eu/?p=9#comment-3</guid>
		<description>Dear Laurens,

I saw your post about AS/400. They send data to AS/400. I´d like to know how to send data in AS/400 to spreadsheet EXCEL.

Thanks.</description>
		<content:encoded><![CDATA[<p>Dear Laurens,</p>
<p>I saw your post about AS/400. They send data to AS/400. I´d like to know how to send data in AS/400 to spreadsheet EXCEL.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
