unfortunately, pivot tables are pretty spreadsheet specific in your instance
here without a lot of monkeying around.... unless you want to roll your own
pivot table coalator in VB (yuck yuckity yuck!)

Client Basic does support OLE/COM...

you can programatically (in Client Basic... if I remember correctly from the
help pages) do a "CreateObject("Excel.Application")"  (lookup CreateObject
in Excel VBA or Client Basic Help)

CreatObject returns an object pointer to a new Excel session that has been
opened through the magic of GUIDs in the registry pointing to excel.exe

from there you should be able to do things like:


' Create OLE object - Excel Application Pointer
xl_app = CreateObject("Excel.Application")

' Set Application Visibility
xl_app.Visible = False

' Open Excel File
workbook = xl_app.Workbooks.Open("my_BOM_munger.xls")

' setup active worksheet
worksheet = workbook.Worksheets(1)

'stuff a value into a cell
worksheet.Range("A1").Value = "fooschnickens"

' retrieve value from worksheet
cellA1 = worksheet.Range("A1").Value
cellB1 = worksheet.Range("B1").Value 'this cell probably has a formula in it
to do something with Cell A1

'do something interesting here with cell values

' Close It Up
xl_app.ActiveWorkbook.Close(0)
xl_app.Quit


Keep in mind that this "VBA" code above may not work as I just ripped it out
of one of my perl scripts and converted it to VBA syntax (I can't remember
if the parenthesis on some of the calls are needed or will work under VBA)

You *CAN* also run your macros in the Excel workbook from this Client Basic
(or at least you should be able to.... I am able to run my own macros/subs
in excel from PERL).... I think however, the macros must be in the
"ThisWorkbook" module in the Sheets section of the VBA editor... I am not
sure if you can call macros in modules (directly) without perhaps a
ThisWorkbook module wrapper...

I think the syntax is (it's been a  while):

workbook.My_Macro

you may have to use the VBA "Run" command (see the help pages for Run in VBA
language reference)

Cheers,
-chris





-----Original Message-----
From: Richard Thompson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 06, 2001 11:10 AM
To: Protel EDA Forum
Subject: [PEDA] VBA Scripts


        Hi Group

        I have written a simple VBA Script within Excel that basically
reformats a BOM from protel, using pivot tables etc.  Is there a way i can
either;

        a:  import the script into Protel and execute it to give me a nice
new BOM from within protel, therefore never having to load excel and
import/export files.

        b: call excel, pass the old BOM to excel and generate the new BOM
inside excel, then pass the new BOM back into Protel.

        c: an easier way of doing either of the above leaving more time for
the pub.

        d: something else.

        Many thanks for the numerous responses.  (realizing i'm a little
premature etc ;-)   )

Rich




Rich Thompson
Research & Development
BLT Industries
Newlyn Road
Cradley Heath
West Midlands
B64 6BE
Tel: 00 44 (0) 1384 567569
Fax: 00 44 (0) 1384 567908
www.laney.co.uk

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* To post a message: mailto:[EMAIL PROTECTED]
*
* To leave this list visit:
* http://www.techservinc.com/protelusers/leave.html
*
* Contact the list manager:
* mailto:[EMAIL PROTECTED]
*
* Forum Guidelines Rules:
* http://www.techservinc.com/protelusers/forumrules.html
*
* Browse or Search previous postings:
* http://www.mail-archive.com/proteledaforum@techservinc.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Reply via email to