🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18194

Re: Checking for existence in VB

#18194
From: Olav Kvern
Date: Mon, 07 Apr 2003 20:40
28 lines
1530 bytes
Chris--

Well--there's probably a more elegant way to do this, but I always use this sort of thing (it's the VB version of a "try...on error...end try" AppleScript):



Err.Clear 
Rem Disable standard error checking and handle errors 
On Error Resume Next 
Rem try to get a reference to a recangle with the label contents "myTag." 
Set myTextFrame = myPage.TextFrames.Item("myTag") 
Rem If the above line generated an error, it's because the object did not exist. 
If Err.Number <> 0 Then 
    Rem Create the object. 
    Set myTextFrame = myPage.TextFrames.Add 
    Rem Apply the tag to the object's label property 
    myTextFrame.Label = "myTag" 
    Err.Clear 
End If 
Rem restore normal error checking 
On Error GoTo 0 




Thanks,

Ole
Technical Details
Message-ID: <1de8a2cf.0@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de8a2cf.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,ded3b14496b0137a
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-04-07 14:08:46 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Checking for existence in VB
Message-ID: <1de8a2cf.0@WebX.la2eafNXanI>
Date: Mon, 7 Apr 2003 13:40:08 -0700
References: <1de8a2cf.-1@WebX.la2eafNXanI>
Lines: 28
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit