cancel
Showing results for 
Search instead for 
Did you mean: 

Transferring data from Excel to SAP

Former Member

Hi Experts,

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?

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?

Could someone please give me a example of this code?

Thanks in advance!

D

Accepted Solutions (1)

Accepted Solutions (1)

script_man
Active Contributor

Hi Degnic,

I am working for some time with Excel and SAP also. You could try the following simple variant.

for example:


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 " & cstr(xclapp.ActiveCell.SpecialCells(11).Row - 1) & " Excel rows have been processed."

Set xclwbk = Nothing
Set xclsht = Nothing
xclapp.Quit
set xclapp = Nothing

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan,

Thanks for very prompt reply! I will get started with this example.

D

Former Member
0 Kudos

Hi, I tried this and is working fine... but is there any way to generate in the excel file the result of the execution of each specific line? this is because if we run 2000 lines (for example) I want to know in which lines the modification was successful and in which font. Appreciated your help.

script_man
Active Contributor
0 Kudos

Hi Daniel,

the example is pretty old, but as you can see, it still works. Depending on how you did implement it, you could try the following.

for example:

. . .

for i = 2 to xclapp.ActiveCell.SpecialCells(11).Row

for j = 1 to xclapp.ActiveCell.SpecialCells(11).Column - 1

  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

myTransaction = "xyz" 

session.findById("wnd[0]/tbar[0]/okcd").text = "/n" & myTransaction

session.findById("wnd[0]").sendVKey 0

on error resume 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.

if err.number <> 0 then

    'The Excel worksheet has e.g. 3 columns of data and an error column.

    xclsht.Cells(i,4).Value = "Here is an error."

else

    xclsht.Cells(i,4).Value = "O.K."

end if

on error goto 0

next

msgbox "All " & cstr(xclapp.ActiveCell.SpecialCells(11).Row - 1) & " Excel rows have been processed."

. . .

Regards,

ScriptMan

Former Member
0 Kudos

Hi Daniel,

you can also try this:

' with this SAP login code, you don't need to define patch, spreadsheet name etc.. just launch the macro from current excel.

If Not IsObject(SAP_applic) Then

        Set SapGuiAuto = GetObject("SAPGUI")

        Set SAP_applic = SapGuiAuto.GetScriptingEngine

        End If

If Not IsObject(session) Then

Set Connection = SAP_applic.Children(0)

End If

If Not IsObject(session) Then

    Set session = Connection.Children(0)

End If

' with this example, customer numbers are in column A, product code B and price C

Dim last As Long

last = Range("A65536").End(xlUp).Row

Sheets("sheet1").Activate

For Each customer In Range("A1:A" & last)

'Transaction details....

....

session.findById("wnd[0]/usr/ctxtKOMG-HIENR").Text = customer

session.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/ctxtKOMG-MATNR[0,0]").Text = customer.Offset(0, 1)

session.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/txtKONP-KBETR[2,0]").Text = customer.Offset(0, 2)

'then you can take the changed field from sap to column D and compared to column C (prices are poor example, you'll get the drill)

strAsset = session.findById("wnd[0]/usr/tblSAPMV13ATCTRL_FAST_ENTRY/txtKONP-KBETR[2,0]").Text

customer.Offset(0, 3).Value = strAsset

Next

MsgBox "ALL " & last - 1 & " Excel rows processed"

end

Answers (6)

Answers (6)

david_h_mertz
Discoverer

I searched through the forums extensively and came up with a solution that includes copying information from Excel into SAP and then using the scroll feature to refresh the table to add more information. This is used with MR21 but could apply to any GuiTableControl object. I'm sure there are better ways to do this, but thought I would share in case this were to help others with a similar problem. I welcome any suggestions on simpler ways to execute the same code!

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:\filepath\excelfile.xls") 'location of file
Set xclsht = xclwbk.Sheets("Sheet1") 

dim count
count = 0

'this is the table that you are trying to manipulate
Set sapTable=session.findbyid("wnd[0]/usr/tabsMR21_TABSTRIP/tabpTAB1/ssubMR21_SUB:SAPRCKM_MR21:0250/tblSAPRCKM_MR21MR21_TABCONTROL")

For i = 0 to 1433 'number of rows you need to read in from excel
     
'these are the cells in the table you need to fill with corresponding excel data
     sapTable.GetCell(count,0).Text = xclsht.Cells(i+1,1).Value
     sapTable.GetCell(count,8).Text = xclsht.Cells(i+1,2).Value
     count=count+1
	'my table is 19 rows but this can be adjusted based on your table view
     if count > 18 then
	sapTable.verticalScrollbar.Position = i
're-initialize table after each scroll to be able to use GetCell again
	Set sapTable=session.findbyid("wnd[0]/usr/tabsMR21_TABSTRIP/tabpTAB1/ssubMR21_SUB:SAPRCKM_MR21:0250/tblSAPRCKM_MR21MR21_TABCONTROL")
	sapTable.verticalScrollbar.Position = i+1
	Set sapTable=session.findbyid("wnd[0]/usr/tabsMR21_TABSTRIP/tabpTAB1/ssubMR21_SUB:SAPRCKM_MR21:0250/tblSAPRCKM_MR21MR21_TABCONTROL")
	'msgbox sapTable.RowCount
	count = 0
     End if

Next

msgbox "Done"


set xclwbk = Nothing
set xclsht = Nothing
xclapp.quit
set xclapp = Nothing 

0 Kudos

Hi David,

Would you mind sharing the source forum you found?

Thanks.

Former Member
0 Kudos

I saw your posted answer. Please raise a new question and follow our rules of engagement: https://community.sap.com/resources/rules-of-engagement. The author of the original question is no longer active in the community and won't receive your query. Feel free to take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html. With these tips you'll be able to prepare questions that draw responses from our members.

Best,
Your SAP Community moderator

david_h_mertz
Discoverer
0 Kudos

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.

Former Member

Hi ScriptMan,

Excellent solution I'll try it also, I have another solution..

Very nice I search for this a long time..

Noa

Former Member
0 Kudos

Hi,

I agree with you Noa, this solution has been very usefull.

Now I was wondering, how am I able to select a single cell in excel and bring the value of the cell to SAP?

I understand that code under defines colums A and B, and row 2 is the first value.

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

But how am I able to select for example cell "C8" and bring the value to here: session.findById("wnd[0]/usr/ctxtF003").text

Degnic

script_man
Active Contributor
0 Kudos

Hi Degnic,

I would suggest that you try the following:


session.findById("wnd[0]/usr/ctxtF003").text = xclsht.Cells(8,3).Value

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan

And thank you very much again!

Degnic

Former Member
0 Kudos

Hi Again,

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:

Is it possible to launch a excel macro with SAP script?

When the excel file is created, it would be great, if the script would already modifie the excel file. Is this possible and how?

Degnic

script_man
Active Contributor
0 Kudos

Hi Degnic,

On the first question, I can present the following example:


. . .
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
. . .

To the second question, I can say the following:

SAP created a workbook in Excel always called "Table of base (1)". Excel - Macro macro_1 must refer to that name.

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.

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan,

And thank you very much again!

I was unable to launch macro with SAP-script.

I tried with this:

Set xclapp = CreateObject("Excel.Application")

xclapp.ScreenUpdating = False

xclapp.Visible = False

xclapp.DisplayAlerts = False

Set xclwbk = xclapp.Workbooks.Open("c:\temp\file1.XLS")

set xclsht = xclwbk.Sheets("SHEET1")

xclapp.Run "file1.xls!macro1"

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.

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?

Degnic

Former Member
0 Kudos

Hi Degnic - I applied ScriptMan's model and worked like a charm for me. Here's the code I used:

Set xclapp = CreateObject("Excel.Application")

xclapp.ScreenUpdating = False

xclapp.Visible = False

xclapp.DisplayAlerts = False

Set xclwbk = xclapp.Workbooks.Open("C:\Documents and Settings\erkmeu\Application Data\Microsoft\Excel\XLSTART\PERSONAL.xls")

xclapp.Run "PERSONAL.xls!TanksRep"

xclapp.Run "PERSONAL.xls!Create_Tanks_Pivot"

xclapp.Run "PERSONAL.xls!Save_File_Tank"

Set xclwbk = Nothing

xclapp.Quit

set xclapp = Nothing

You'll notice that I am calling 3 Excel macros one after the other.

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:

SAP script 1 for vessels

Excel macros 1-3 - generate pivot and charts

SAP script 2 for tanks

Excel macros 1-3 generate pivot and charts

SAP script 3 safety valves

Excel macros 1-3 generate pivot and charts

All of these run in one SAP script. One click does it all.

ScriptMan - thanks again.

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Degnic,

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").

Can start the macro named Macro1 manually from Excel? I see no error in your code.

Umur - I am pleased to have helped you.

Regards,

ScriptMan

Former Member
0 Kudos

Hi ScriptMan,

And thanks again! I finally got it to work when I tried the different computer and excel version 2003 instead of 2007.

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!

BR

Degnic

Former Member
0 Kudos

ScriptMan - a quick question on your reply to Degnic...

-


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").

-


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'.

Regards

Umur

script_man
Active Contributor
0 Kudos

Hi Umur,

I think there are several solutions. One of them may look like as :


. . .
on error resume next
xclapp = GetObject (, "Excel.Application") 
if err.number > 0 or err.number < 0 then set xclapp = CreateObject("Excel.Application")
on error goto 0
. . .

There is much more between Excel and SAP what one has not yet addressed.

Degnic - Thank you for your positive assessment

Regards,

ScriptMan

Edited by: ScriptMan on Aug 7, 2010 6:09 AM

Former Member
0 Kudos

Hi,

Lets continue this script, as it has been so usefull.

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?

D

Former Member
0 Kudos

Hey Script Man and guys!,

I am building a table in excel listing some vendors. Each vendor has a corresponding vendor number in our system. I have all of the vendor numbers in an excel column. I am creating a button next to each vendor, and what I want is that when clicking the button, it will run an SAP transaction (ME2L), copy their vendor number into the corresponding vendor field in SAP, and execute the transaction (if possible, if not, then the user can click execute).

I was able to make it open up the transaction, when clicking the button, but I can't seem to be able to copy and paste the vendor number to the Vendor field in SAP. It gives me an error and it says I need an object.

Here's what I have so far: (Note that my VBA coding skills are veeeery limited haha). Please help!

script_man
Active Contributor
0 Kudos

Hi Ivana,

welcome to the forum. This thread still seems to be up to date after a few years.

You can try the following:


session.findById("wnd[0]/usr/ctxtVendor").Text = cells(9,15).value   'for vendor number in row = 9 and column = 15

or

session.findById("wnd[0]/usr/ctxtVendor").Text = cells(activeCell.Row, activeCell.Column).value   'for the contents of an active cell

Regards,

ScriptMan

Former Member
0 Kudos

Hey Script Man!

Thanks for the reply

Weeeell.. I tried both of them. It still won't work and it tells me that the control couldn't be found by id, and it relates to that command. Does that mean that "Vendor" is not the field's id?

Thanks,

Ivana

holger_khn
Contributor
0 Kudos

Hello.

Is your code snippet from SAP Scripting recording?

When I do an recording I got below code:


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

session.findById("wnd[0]").maximize

session.findById("wnd[0]/tbar[0]/okcd").text = "/nME2L"

session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/ctxtEL_LIFNR-LOW").text = "MyVendor"

session.findById("wnd[0]/tbar[1]/btn[8]").press

Former Member
0 Kudos

Hey there!

No, I'm doing it on Visual Basic on Excel.

Never really used vbs.

holger_khn
Contributor
0 Kudos

Sure. But from where you got the correct component identifier?

like "session.findById("wnd[0]/usr/ctxtVendor").Text"?

This is not existing. You Need to perform an SAP Scripting recording which can be implemented in Excel VBA coding.

Former Member
0 Kudos

OMG! I'm so happy right now haha thaaank you so much!


0 Kudos

Hello Experts,

Is it possible to integrate OLE feature using SAP UI5?

For getting OLE features do we need to include any library in SAP UI5 appliction.

Usecase:

If user click on link in SAP UI5 screen OLE will open EXCEL sheet with the graph data and it has to show the line graph in the EXCEL.

Regards

Srikanth.

Former Member
0 Kudos

Hello Experts,

I have some questions

I have data in excel,

CC    GL         Purchase order

001   191200   4504567890 (10 digits) every day i copy this data one by one from excel and paste in to SAP and i will execute.

Request you to please advice what would be the coding for this from excel.

Regards

Ravi

holger_khn
Contributor
0 Kudos

Hello Ravi.

Use one of the above examples and modify for your requirement. Do a recording of your Actions and include this in your Excel VBA coding. Best regards, Holger

Former Member
0 Kudos

Hi Holger,

Thanks,

I am working on it, will let you know the debug error very soon.

I am trouble shooting from one more

In Excel 2003 i have Inter company tab and GRIR tab,

1) I put pivot to inter company like below

a) In the  BU i have A and B,i want to filter only A, Request you to advice what would the coding

Clearing Document(blank)
Sum of Amount in LCAge Bracket
BUSBUabove 360 days91 to 180181 to 360currentGrand Total
AAC100.000.00100.00
BUKP200.00200.00
Grand Total300.00300.00

Note: Data will get changed day by day, today day report i have BU => A , tomorrow  it may be or may not be available in the inter company data. then i also i will put a pivot and filter by BU=> B.

Kindly let me know if you have any questions.

Regards

Ravi

Former Member
0 Kudos

HI, Script Man

im new about scripts in SAP,

i want do make is optimizate an orders notification process what we do every month.

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:

******************************************************************************************

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:\Users\ccoaquim\Desktop\Libro1.xls")
set xclsht = xclwbk.Sheets("Hoja3")

for i= 4 to 8


session.findById("wnd[0]/tbar[0]/okcd").text = "/N iw41"
session.findById("wnd[0]").sendVKey 0

if xclsht.Cells(i+1,3).Value > 10 then

session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").text = xclsht.Cells(i,2).Value
session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").setFocus
session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").caretPosition = 9
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/tblSAPLCORUTC_3100").getAbsoluteRow(0).selected = true
session.findById("wnd[0]/usr/tblSAPLCORUTC_3100/txtCORUF-UPD_ICON[0,0]").setFocus
session.findById("wnd[0]/usr/tblSAPLCORUTC_3100/txtCORUF-UPD_ICON[0,0]").caretPosition = 0
session.findById("wnd[0]/tbar[1]/btn[8]").press

session.findById("wnd[0]/usr/txtW_NOPERS").text = xclsht.Cells(i,8).Value
session.findById("wnd[0]/usr/txtW_DURPERS").text = xclsht.Cells(i,6).Value
session.findById("wnd[0]/usr/txtW_AUTOR").text = xclsht.Cells(i,10).Value
session.findById("wnd[0]/usr/ctxtAFRUD-ISDD").text = xclsht.Cells(i,11).Value
session.findById("wnd[0]/usr/ctxtAFRUD-ISDZ").text = xclsht.Cells(i,13).Value
session.findById("wnd[0]/usr/ctxtAFRUD-IEDD").text = xclsht.Cells(i,14).Value
session.findById("wnd[0]/usr/ctxtAFRUD-IEDZ").text = xclsht.Cells(i,16).Value
session.findById("wnd[0]/usr/ctxtAFRUD-GRUND").text = "1001"
session.findById("wnd[0]/usr/txtAFRUD-LTXA1").text = xclsht.Cells(i,17).Value
session.findById("wnd[0]/usr/txtAFRUD-LTXA1").setFocus
session.findById("wnd[0]/usr/txtAFRUD-LTXA1").caretPosition = 1
session.findById("wnd[0]/tbar[0]/btn[11]").press
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0

else

session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").text = xclsht.Cells(i,2).Value
session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").setFocus
session.findById("wnd[0]/usr/ctxtCORUF-AUFNR").caretPosition = 9
session.findById("wnd[0]").sendVKey 0

session.findById("wnd[0]/usr/txtW_NOPERS").text = xclsht.Cells(i,8).Value
session.findById("wnd[0]/usr/txtW_DURPERS").text = xclsht.Cells(i,6).Value
session.findById("wnd[0]/usr/txtW_AUTOR").text = xclsht.Cells(i,10).Value
session.findById("wnd[0]/usr/ctxtAFRUD-ISDD").text = xclsht.Cells(i,11).Value
session.findById("wnd[0]/usr/ctxtAFRUD-ISDZ").text = xclsht.Cells(i,13).Value
session.findById("wnd[0]/usr/ctxtAFRUD-IEDD").text = xclsht.Cells(i,14).Value
session.findById("wnd[0]/usr/ctxtAFRUD-IEDZ").text = xclsht.Cells(i,16).Value
session.findById("wnd[0]/usr/ctxtAFRUD-GRUND").text = "1001"
session.findById("wnd[0]/usr/txtAFRUD-LTXA1").text = xclsht.Cells(i,17).Value
session.findById("wnd[0]/usr/txtAFRUD-LTXA1").setFocus
session.findById("wnd[0]/usr/txtAFRUD-LTXA1").caretPosition = 1
session.findById("wnd[0]/tbar[0]/btn[11]").press
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0

end if

next

******************************************************************************

i just notice that the comand "if" is not working, i mean that in the line 25:

"if xclsht.Cells(i+1,3).Value > 10 then"

the script doesnt follow the "if" comand, and it also continue with the comands which are after

the comand : "else"

Please i'd be very thankfull to get an answer

Thanks

Jorge Chávez

script_man
Active Contributor
0 Kudos

Hi Jorge,

you can try this:

. . .

j=i+1

if xclsht.Cells(j,3).Value > 10 then

. . .

Regards,

ScriptMan

Former Member
0 Kudos

thanks a lot for ur answer... it worked!

now one more question...

in the part when i put:

Set xclwbk = xclapp.Workbooks.Open("C:\Users\ccoaquim\Desktop\Libro1.xls")

im making reference to a local disc in my pc "C:\",

can i reference a disc which is not a local one, a disc that i had added from my local network ?

i tried like this:

Set xclwbk = xclapp.Workbooks.Open("\\pebk016440\d:\Users\ccoaquim\Desktop\Libro1.xls")

but it didnt work..

thnks for ur answer!

holger_khn
Contributor
0 Kudos

Hello Jorge.

I wonder that you try to reference on a networkfolder which is named => "...d:\Users\ccoaquim\Desktop\Libro1.xls"

Set xclwbk = xclapp.Workbooks.Open("\\pebk016440\YourNetworkfolder\Libro.xls")

Should look like above \\pepk016440 is your server => \YourNetworkfolder is the folder where your files are stored

Former Member
0 Kudos

This message was moderated.