Article View: adobe.scripting.indesign
Article #18347Re: Excel import
From: Iolaire McFadden
Date: Tue, 01 Apr 2003 22:21
Date: Tue, 01 Apr 2003 22:21
26 lines
2091 bytes
2091 bytes
See if this helps you it is a code snipet only but it should get you started. There are many ways to get data from excel, this examples Illstrates using a pre-setup pivot table.
REM #1 I do all of my scripting in Excel thus I'm leaving out a lot of coding to load Excel
REM I have a worksheet named Table with a PivotTable named chart_area
REM The pivot table has columns named Quarter, Sum of rba_ex, Under Construction, Net Absorption, Office Vacancy
REM The pivot table has 2 rows, 1 for each of two quarters
REM I have the current quarter value entered into the variable current_qtr
REM I want to pull the Sum of rba_ex as my inventory and
REM chart_area is the name of my pivot table
myinventory = Worksheets("Table").PivotTables("chart_area") _
.GetData("'Sum of rba_ex' 'Quarter' '" & current_qtr & "'")
REM I want to format the inventory a number with commas
myinventory = Format(myinventory, "#,##0")
REM move the data to Illustrator
REM I've already loaded Illustrator as appRef
Set targetDocument = appRef.ActiveDocument
REM In my targetdocument I have a text item labeled Current Inventory
REM So all I do is replace the contents
targetDocument.TextArtItems("Current Inventor").Contents = myinventory
Let me know if that helps,
iolaire
Technical Details
Message-ID:
<1de88449.1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de88449.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,443dc24c5e53e228 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-04-01 14:37:56 PST From: "Iolaire McFadden" <imcfadden@costar.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Excel import Message-ID: <1de88449.1@WebX.la2eafNXanI> Date: Tue, 1 Apr 2003 14:21:34 -0800 References: <1de88449.-1@WebX.la2eafNXanI> Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit