🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15396

VB.NET and SEARCH...

#15396
From: dean_kroon
Date: Tue, 02 Dec 2003 15:12
28 lines
1558 bytes
The following code works great in VB6:

' Select a range of text and change the character style

myInDesign.Select myTextFrame.ParentStory.TextStyleRanges.Item(1)
    Set eeff = myInDesign.Selection.Item(1)
    eeff.CharacterStyle = curCharStyle

But I get an automation error when I do the same thing in VB.NET...

Dim foundobject

inDesignApp.Select(myTextFrame.ParentStory.TextStyleRanges.Item(1))
      foundobject = inDesignApp.Selection.Item(1)
      foundobject.CharacterStyle = curCharStyle ' ERROR HERE!!!

The first two lines work fine, but the last line gives me the following error:

An unhandled exception of
   type 'System.Runtime.InteropServices.COMException' occurred in
   microsoft.visualbasic.dll

Additional information: Unspecified error

I have tried several things, but none work? I assume it is a casting issue, but I do not know what type will be returned by search. Do you have any suggestions?

Thanks,
    Dean.
Technical Details
Message-ID: <2cceb05e.-1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,8b1f02cd57c22f97,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-12-02 07:37:47 PST
From: dean_kroon@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: VB.NET and SEARCH...
Message-ID: <2cceb05e.-1@webx.la2eafNXanI>
Date: Tue, 2 Dec 2003 07:12:05 -0800
Lines: 32
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit