Where are you getting the error? If you don’t know, open a display client with the vba window, you can step through the code by placing the cursor in the debug vba window routine you want to test and repeatedly pressing the F8 key

Insert VBA code to Excel Workbook
Open your workbook in Excel.
Press Alt + F11 to open Visual Basic Editor (VBE).
Right-click on your workbook name in the "Project-VBAProject" pane (at the top left corner of the editor window) and select Insert -> Module from the context menu.

Hello friends;
When i try to add refrence risopc.dll which is in common files\rockwell in excell2003 and also try in 2007 it shows a popup can not create a new automation server or you have no privillage