<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Transferring data from Excel to SAP in Additional Q&amp;A</title>
    <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035976#M69183</link>
    <description>&lt;P&gt;This is the post I used for the Excel to SAP example code.  I searched other posts for the scroll feature and GetCell functions.  Hope that clarifies.  &lt;/P&gt;</description>
    <pubDate>Wed, 14 Apr 2021 01:15:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2021-04-14T01:15:48Z</dc:date>
    <item>
      <title>Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaq-p/7035938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My purpose is to update customer prices from Excel to SAP automatically with a script. My problem is: I dont know how to call a certain Excel-file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I record a script that opens transaction VK11 and put the right constants in right places places, how shall I call it to open an excel-file and then pick information from cells A1(customer number) B1(product number) C1(price) and then save it and then continue picking rows from excel until blank comes ahead?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone please give me a example of this code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 May 2010 10:10:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaq-p/7035938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-31T10:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035939#M69146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Degnic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working for some time with Excel and SAP also. You could try the following simple variant.&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If

Set xclapp = CreateObject("Excel.Application")
Set xclwbk = xclapp.Workbooks.Open("c:\tmp\prices.xls")
set xclsht = xclwbk.Sheets("Tabelle1")

for i = 2 to xclapp.ActiveCell.SpecialCells(11).Row
 for j = 1 to xclapp.ActiveCell.SpecialCells(11).Column 
  if j=1 then CUSTOMER =  xclsht.Cells(i,j).Value 
  if j=2 then  PRODUCT =  xclsht.Cells(i,j).Value 
  if j=3 then PRICE =  xclsht.Cells(i,j).Value 
 next
 session.findById("wnd[0]/usr/. . .").text = CUSTOMER
 session.findById("wnd[0]/usr/. . .").text = PRODUCT
 session.findById("wnd[0]/usr/. . .").text = PRICE
  . . .
  'Here follows the rest of the VBScript.
next
msgbox "All " &amp;amp; cstr(xclapp.ActiveCell.SpecialCells(11).Row - 1) &amp;amp; " Excel rows have been processed."

Set xclwbk = Nothing
Set xclsht = Nothing
xclapp.Quit
set xclapp = Nothing
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ScriptMan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 May 2010 12:30:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035939#M69146</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2010-05-31T12:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035940#M69147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ScriptMan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for very prompt reply! I will get started with this example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jun 2010 07:07:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035940#M69147</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-06-01T07:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035941#M69148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ScriptMan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Excellent solution I'll try it also, I have another solution..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very nice I search for this a long time..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Noa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jul 2010 12:52:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035941#M69148</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-27T12:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035942#M69149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with you Noa, this solution has been very usefull. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I was wondering, how am I able to select a single cell in excel and bring the value of the cell to SAP? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that code under defines colums A and B, and row 2 is the first value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i = 2 to xclapp.ActiveCell.SpecialCells(11).Row&lt;/P&gt;&lt;P&gt;for j = 1 to xclapp.ActiveCell.SpecialCells(11).Column&lt;/P&gt;&lt;P&gt;if j=1 then CUSTOMER =  xclsht.Cells(i,j).Value&lt;/P&gt;&lt;P&gt;if j=2 then  PRODUCT =  xclsht.Cells(i,j).Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But how am I able to select for example cell "C8" and bring the value to here: session.findById("wnd[0]/usr/ctxtF003").text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Degnic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 07:12:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035942#M69149</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-28T07:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035943#M69150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Degnic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest that you try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
session.findById("wnd[0]/usr/ctxtF003").text = xclsht.Cells(8,3).Value
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ScriptMan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 09:44:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035943#M69150</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2010-07-28T09:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035944#M69151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ScriptMan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And thank you very much again!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Degnic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 09:40:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035944#M69151</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-07-29T09:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035945#M69152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a script, which runs a certain report to me from SAP and creates a excel file of the results. Now my question is:&lt;/P&gt;&lt;P&gt;Is it possible to launch a excel macro with SAP script? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the excel file is created, it would be great, if the script would already modifie the excel file. Is this possible and how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Degnic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 08:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035945#M69152</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-03T08:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035946#M69153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Degnic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the first question, I can present the following example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
. . .
Set xclapp = GetObject(, "Excel.Application")
xclapp.ScreenUpdating = False
xclapp.Visible = False
xclapp.DisplayAlerts = False

Set xclwbk = xclapp.Workbooks.Open("c:\tmp\macroworksheet.xls")
xclapp.Run "macroworksheet.xls!macro_1"
 
Set xclwbk = Nothing
xclapp.Quit
set xclapp = Nothing
. . .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To the second question, I can say the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP created a workbook in Excel always called "Table of base (1)". Excel - Macro macro_1 must refer to that name.&lt;/P&gt;&lt;P&gt;The launch of macro_1 must be done in VB script to a suitable place. E.g. is suitable to the place where an Excel file is created. After exiting the macro_1 VB script continues normally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ScriptMan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 12:41:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035946#M69153</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2010-08-03T12:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035947#M69154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ScriptMan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And thank you very much again! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was unable to launch macro with SAP-script. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried with this:&lt;/P&gt;&lt;P&gt;Set xclapp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;xclapp.ScreenUpdating = False&lt;/P&gt;&lt;P&gt;xclapp.Visible = False&lt;/P&gt;&lt;P&gt;xclapp.DisplayAlerts = False&lt;/P&gt;&lt;P&gt;Set xclwbk = xclapp.Workbooks.Open("c:\temp\file1.XLS")&lt;/P&gt;&lt;P&gt;set xclsht = xclwbk.Sheets("SHEET1")&lt;/P&gt;&lt;P&gt;xclapp.Run "file1.xls!macro1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I get this error message, that  the macro does not found. I also tried to place the same macro from excel module to "sheet1" and "thisworkbook" in VBA editor, but still it does not found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You suggest that the first row should be like: Set xclapp = GetObject(, "Excel.Application"). I changed the "GETOBJECT" to "CreateObject", because when I use "GetObject", I get a error message of activeX component. Does this cause the error message of the missing macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Degnic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 11:28:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035947#M69154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-04T11:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035948#M69155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Degnic - I applied ScriptMan's model and worked like a charm for me. Here's the code I used:&lt;/P&gt;&lt;P&gt;Set xclapp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;xclapp.ScreenUpdating = False&lt;/P&gt;&lt;P&gt;xclapp.Visible = False&lt;/P&gt;&lt;P&gt;xclapp.DisplayAlerts = False&lt;/P&gt;&lt;P&gt;Set xclwbk = xclapp.Workbooks.Open("C:\Documents and Settings\erkmeu\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls")&lt;/P&gt;&lt;P&gt;xclapp.Run "PERSONAL.xls!TanksRep"&lt;/P&gt;&lt;P&gt;xclapp.Run "PERSONAL.xls!Create_Tanks_Pivot"&lt;/P&gt;&lt;P&gt;xclapp.Run "PERSONAL.xls!Save_File_Tank"&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Set xclwbk = Nothing&lt;/P&gt;&lt;P&gt;xclapp.Quit&lt;/P&gt;&lt;P&gt;set xclapp = Nothing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll notice that I am calling 3 Excel macros one after the other. &lt;/P&gt;&lt;P&gt;This helped me in getting 3 separately-run SAP scripts, each calling an Excel macro to generate refined output files, all merged in one script. So it goes like this, for 3 different type of equipment being analyzed:&lt;/P&gt;&lt;P&gt;SAP script 1 for vessels&lt;/P&gt;&lt;P&gt;Excel macros 1-3 - generate pivot and charts&lt;/P&gt;&lt;P&gt;SAP script 2 for tanks&lt;/P&gt;&lt;P&gt;Excel macros 1-3 generate pivot and charts&lt;/P&gt;&lt;P&gt;SAP script 3 safety valves&lt;/P&gt;&lt;P&gt;Excel macros 1-3 generate pivot and charts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of these run in one SAP script. One click does it all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ScriptMan - thanks again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Umur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 15:21:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035948#M69155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-04T15:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035949#M69156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Degnic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as I said the command set xclapp = GetObject (, "Excel.Application") can be used only at the point when an Excel session was already open. Otherwise, it is correct to set instead set xclapp = CreateObject("Excel.Application").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can start the macro named Macro1 manually from Excel? I see no error in your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Umur - I am pleased to have helped you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ScriptMan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 16:41:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035949#M69156</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2010-08-04T16:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035950#M69157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ScriptMan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And thanks again! I finally got it to work when I tried the different computer and excel version 2003 instead of 2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has been very usufull thread! You must be very valueable to your company. I think you should go and ask for a raise to your sallary. I can recommend you for sure!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Degnic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 12:40:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035950#M69157</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-05T12:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035951#M69158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ScriptMan - a quick question on your reply to Degnic...&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;as I said the command set xclapp = GetObject (, "Excel.Application") can be used only at the point when an Excel session was already open. Otherwise, it is correct to set instead set xclapp = CreateObject("Excel.Application").&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;Is there a way to get the script check first if Excel is already open or not? If there is, then a IF statement can apply the correct line whether it is 'get' or 'create'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Umur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Aug 2010 20:54:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035951#M69158</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-06T20:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035952#M69159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Umur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think there are several solutions. One of them may look like as :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
. . .
on error resume next
xclapp = GetObject (, "Excel.Application") 
if err.number &amp;gt; 0 or err.number &amp;lt; 0 then set xclapp = CreateObject("Excel.Application")
on error goto 0
. . .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is much more between Excel and SAP what one has not yet addressed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Degnic - Thank you for your positive assessment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ScriptMan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: ScriptMan on Aug 7, 2010 6:09 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Aug 2010 04:08:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035952#M69159</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2010-08-07T04:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035953#M69160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Aug 2010 08:38:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035953#M69160</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-15T08:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035954#M69161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets continue this script, as it has been so usefull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know, is it possible to launch SAP script with excel macro? I added the code of the script at the end of the excel macro code, but it did not work. How shall you call a SAP script in excel macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Sep 2010 12:10:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035954#M69161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-07T12:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035955#M69162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI, Script Man&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im new about scripts in SAP, &lt;/P&gt;&lt;P&gt;i want do make is optimizate an orders notification process what we do every month.&lt;/P&gt;&lt;P&gt;what i did is to record a script and then (by the notepad program) modificated it, putting the values that i want in a worksheet (excel) and taking the values from that sheet, my whole code is the following one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;******************************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If Not IsObject(application) Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set SapGuiAuto&amp;nbsp; = GetObject("SAPGUI")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set application = SapGuiAuto.GetScriptingEngine&lt;BR /&gt;End If&lt;BR /&gt;If Not IsObject(connection) Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set connection = application.Children(0)&lt;BR /&gt;End If&lt;BR /&gt;If Not IsObject(session) Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Set session&amp;nbsp;&amp;nbsp;&amp;nbsp; = connection.Children(0)&lt;BR /&gt;End If&lt;BR /&gt;If IsObject(WScript) Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject session,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "on"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; WScript.ConnectObject application, "on"&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Set xclapp = CreateObject("Excel.Application")&lt;BR /&gt;Set xclwbk = xclapp.Workbooks.Open("C:\Users\ccoaquim\Desktop\Libro1.xls")&lt;BR /&gt;set xclsht = xclwbk.Sheets("Hoja3")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for i= 4 to 8&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;session.findById("wnd[0]/tbar[0]/okcd").text = "/N iw41"&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if xclsht.Cells(i+1,3).Value &amp;gt; 10 then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").text = xclsht.Cells(i,2).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").setFocus&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").caretPosition = 9&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;BR /&gt;session.findById("wnd[0]/usr/tblSAPLCORUTC_3100").getAbsoluteRow(0).selected = true&lt;BR /&gt;session.findById("wnd[0]/usr/tblSAPLCORUTC_3100/txtCORUF-UPD_ICON[0,0]").setFocus&lt;BR /&gt;session.findById("wnd[0]/usr/tblSAPLCORUTC_3100/txtCORUF-UPD_ICON[0,0]").caretPosition = 0&lt;BR /&gt;session.findById("wnd[0]/tbar[1]/btn[8]").press&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/txtW_NOPERS").text = xclsht.Cells(i,8).Value &lt;BR /&gt;session.findById("wnd[0]/usr/txtW_DURPERS").text = xclsht.Cells(i,6).Value &lt;BR /&gt;session.findById("wnd[0]/usr/txtW_AUTOR").text = xclsht.Cells(i,10).Value &lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-ISDD").text = xclsht.Cells(i,11).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-ISDZ").text = xclsht.Cells(i,13).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-IEDD").text = xclsht.Cells(i,14).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-IEDZ").text = xclsht.Cells(i,16).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-GRUND").text = "1001"&lt;BR /&gt;session.findById("wnd[0]/usr/txtAFRUD-LTXA1").text = xclsht.Cells(i,17).Value&lt;BR /&gt;session.findById("wnd[0]/usr/txtAFRUD-LTXA1").setFocus&lt;BR /&gt;session.findById("wnd[0]/usr/txtAFRUD-LTXA1").caretPosition = 1&lt;BR /&gt;session.findById("wnd[0]/tbar[0]/btn[11]").press&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").text = xclsht.Cells(i,2).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").setFocus&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").caretPosition = 9&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;P&gt;session.findById("wnd[0]/usr/txtW_NOPERS").text = xclsht.Cells(i,8).Value &lt;BR /&gt;session.findById("wnd[0]/usr/txtW_DURPERS").text = xclsht.Cells(i,6).Value &lt;BR /&gt;session.findById("wnd[0]/usr/txtW_AUTOR").text = xclsht.Cells(i,10).Value &lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-ISDD").text = xclsht.Cells(i,11).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-ISDZ").text = xclsht.Cells(i,13).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-IEDD").text = xclsht.Cells(i,14).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-IEDZ").text = xclsht.Cells(i,16).Value&lt;BR /&gt;session.findById("wnd[0]/usr/ctxtAFRUD-GRUND").text = "1001"&lt;BR /&gt;session.findById("wnd[0]/usr/txtAFRUD-LTXA1").text = xclsht.Cells(i,17).Value&lt;BR /&gt;session.findById("wnd[0]/usr/txtAFRUD-LTXA1").setFocus&lt;BR /&gt;session.findById("wnd[0]/usr/txtAFRUD-LTXA1").caretPosition = 1&lt;BR /&gt;session.findById("wnd[0]/tbar[0]/btn[11]").press&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;BR /&gt;session.findById("wnd[0]").sendVKey 0&lt;/P&gt;&lt;P&gt;end if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;******************************************************************************&lt;/P&gt;&lt;P&gt;i just notice that the comand "if" is not working, i mean that in the line 25:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"if xclsht.Cells(i+1,3).Value &amp;gt; 10 then"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the script doesnt follow the "if" comand, and it also continue with the comands which are after&lt;/P&gt;&lt;P&gt;the comand : "else"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please i'd be very thankfull to get an answer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jorge Chávez &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 20:12:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035955#M69162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-04-23T20:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035956#M69163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jorge,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;. . .&lt;/P&gt;&lt;P&gt;j=i+1&lt;/P&gt;&lt;P&gt;if xclsht.Cells(j,3).Value &amp;gt; 10 then&lt;/P&gt;&lt;P&gt;. . .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;ScriptMan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 15:42:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035956#M69163</guid>
      <dc:creator>script_man</dc:creator>
      <dc:date>2013-04-24T15:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Transferring data from Excel to SAP</title>
      <link>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035957#M69164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot for ur answer... it worked!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now one more question...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the part when i put:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set xclwbk = xclapp.Workbooks.Open("C:\Users\ccoaquim\Desktop\Libro1.xls")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im making reference to a local disc in my pc "C:\", &lt;/P&gt;&lt;P&gt;can i reference a disc which is not a local one, a disc that i had added from my local network ?&lt;/P&gt;&lt;P&gt;i tried like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set xclwbk = xclapp.Workbooks.Open("&lt;A&gt;\\pebk016440\d:\Users\ccoaquim\Desktop\Libro1.xls&lt;/A&gt;")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it didnt work.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnks for ur answer!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 May 2013 13:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/additional-q-a/transferring-data-from-excel-to-sap/qaa-p/7035957#M69164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-05-03T13:07:27Z</dc:date>
    </item>
  </channel>
</rss>

