11/25/2024 6:38:50 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss SalesLogix legacy development including views, scripts, etc.. View the code of conduct for posting guidelines.
|
|
|
|
Legacy Code intgrating with Excel
Posted: 17 Jun 08 8:14 AM
|
Hi,
I am starting my first custom integration with Excel and i need some help.
I am trying to write so code that will allow the user to select and Excel file which, amongst other values, contains InternalAccountNo.
I want to be able to loop through all the Excel rows and having read this value, perform some check in SLX.
I then want to write some values on to the end to the row in the Excel file.
I have expanded on the basic idea from the example in the dev ref but I am getting a little stuck.
I have access the VB Object Explorer from the Marco editor inside Excel and can see all the Object, Methods, etc but I am having some trouble with certain elements.
All of this work perfectly:
Set objExcel = CreateObject("Excel.Application") objExcel.Workbooks.Add(strFile) 'This is the .xls file to use msgbox objExcel.Worksheets(1).Name objExcel.Worksheets(1).Select 'Select the Worksheet we need to use objExcel.Visible = True 'Watch Excel work while posting objExcel.Range("A1").Select
but it does not like:
objExcel.Range(Selection, Selection.End(xlDown)).Select
even if i put in the actual value instead of xlDown
objExcel.Range(Selection, Selection.End(-4121)).Select
I even tried
objExcel.Range(objExcel.Selection, objExcel.Selection.End(xlDown)).Select objExcel.Range(objExcel.Selection, objExcel.Selection.End(-4121)).Select
Can someone steer me in the right direction as I would like to keep all of this inside SLX if I can, or am I going to have to do all of this in VB and have the user simply launch a custom app?
Thanks in advance |
|
|
|
Re: Legacy Code intgrating with Excel
Posted: 25 Jun 08 11:43 PM
|
First of all... Legacy (Cypress Enable) does a very poor job of supporting COM (CreateObject) - especially Excel. Severe memory leaks. The only solution is to upgrade to a version of SalesLogix tha supports VBScripting (ex: 7.2.2).
For your specific problem, I suggest turning on the Excel macro recorder and doing it manually. Then look at what it recorded. That is how most of us do this kind of thing. -- RJLedger - rjlSystems "... Customer First..." |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|