Reload Xref's

Reload Xref's

Anonymous
Not applicable
491 Views
7 Replies
Message 1 of 8

Reload Xref's

Anonymous
Not applicable
Hello,

Is it possible to reload xref's using vb?

How?
0 Likes
492 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
Yes - For each XREF in your drawing there is an AcadBlock
object in the Blocks collection. The AcadBlock object has
methods Unload() and Reload() that will unload and reload
an external reference.


"Mark Palacios" wrote in message
news:f09ff39.-1@WebX.maYIadrTaRb...
> Hello,
>
> Is it possible to reload xref's using vb?
>
> How?
>
>
>
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
Thank you very much,

 

I did as you suggested and created the following
code:

 

  Private objADT As
AcadApplication
  Private objDoc As AcadDocument
  Private
objBlock As Object
  Private objBlocks As AcadBlocks

 

  Set objDoc =
objADT.ActiveDocument
  Set objBlocks = objDoc.Blocks

 

  For Each objBlock In
objBlocks
    If objBlock.IsXRef = True
Then
      objBlock.Reload
    End
If
  Next

 

Upon completion, it crashes with a Automation
Error.  If I insert

 

  On Error Resume
Next

 

prior to the For..Each loop it works ok. 
However sometimes it does not work.  It seems to skip Xref's that are
inserted in paperspace the first time, but then later it will work on them
also.  I am so comfused.  Any suggestions?

 

 

 

 

> Yes - For each
XREF in your drawing there is an AcadBlock
> object in the Blocks
collection. The AcadBlock object has
> methods Unload() and Reload() that
will unload and reload
> an external reference.
>
>
>
"Mark Palacios" <

size=2>mark@palacios
> wrote in
message
>

face=Arial size=2>news:f09ff39.-1@WebX.maYIadrTaRb

size=2>...
> > Hello,
> >
> > Is it possible to
reload xref's using vb?
> >
> > How?
> >
>
>
> >
> >
>
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
"Mark Palacios" wrote in message
news:CE3953803D1A2CFCAFDBB327377E3A39@in.WebX.maYIadrTaRb...
>
> Upon completion, it crashes with a Automation Error.

What is the error?
0 Likes
Message 5 of 8

Anonymous
Not applicable
It says:

Run-Time Error -2147467259 (80004005)
Automation Error


"Tony Tanzillo" wrote in message
news:BE2AFF60175CCCFBE5E45FDD855CDD13@in.WebX.maYIadrTaRb...
> "Mark Palacios" wrote in message
> news:CE3953803D1A2CFCAFDBB327377E3A39@in.WebX.maYIadrTaRb...
> >
> > Upon completion, it crashes with a Automation Error.
>
> What is the error?
>
>
0 Likes
Message 6 of 8

Anonymous
Not applicable
I'm not really sure what is causing that, but I would
not be able to tell you much without seeing the code.

"Mark Palacios" wrote in message
news:62FF2CEC68583E43C52994307AD0D714@in.WebX.maYIadrTaRb...
> It says:
>
> Run-Time Error -2147467259 (80004005)
> Automation Error
>
>
> "Tony Tanzillo" wrote in message
> news:BE2AFF60175CCCFBE5E45FDD855CDD13@in.WebX.maYIadrTaRb...
> > "Mark Palacios" wrote in message
> > news:CE3953803D1A2CFCAFDBB327377E3A39@in.WebX.maYIadrTaRb...
> > >
> > > Upon completion, it crashes with a Automation Error.
> >
> > What is the error?
> >
> >
>
>
0 Likes
Message 7 of 8

Anonymous
Not applicable
Using the following code in VBA

Dim objBlock As AcadBlock
Dim objBlocks As AcadBlocks

Set objBlocks = Application.ActiveDocument.Blocks
For Each objBlock In objBlocks
If objBlock.IsXRef = True Then
objBlock.Reload
End If
Next

causes the same automation error after it iterates through the the blocks
collection.




"Tony Tanzillo" wrote in message
news:829EBF9ACCE2779B47C7A16711E5FC2B@in.WebX.maYIadrTaRb...
> I'm not really sure what is causing that, but I would
> not be able to tell you much without seeing the code.
>
> "Mark Palacios" wrote in message
> news:62FF2CEC68583E43C52994307AD0D714@in.WebX.maYIadrTaRb...
> > It says:
> >
> > Run-Time Error -2147467259 (80004005)
> > Automation Error
> >
> >
> > "Tony Tanzillo" wrote in message
> > news:BE2AFF60175CCCFBE5E45FDD855CDD13@in.WebX.maYIadrTaRb...
> > > "Mark Palacios" wrote in message
> > > news:CE3953803D1A2CFCAFDBB327377E3A39@in.WebX.maYIadrTaRb...
> > > >
> > > > Upon completion, it crashes with a Automation Error.
> > >
> > > What is the error?
> > >
> > >
> >
> >
>
>
0 Likes
Message 8 of 8

Anonymous
Not applicable
You say this happens after iterating through the
blocks collection. Does the code completely process
all blocks before the error occurs?

"Mark Palacios" wrote in message
news:7A80F0AB61908A635F6B23BA6B58212B@in.WebX.maYIadrTaRb...
> Using the following code in VBA
>
> Dim objBlock As AcadBlock
> Dim objBlocks As AcadBlocks
>
> Set objBlocks = Application.ActiveDocument.Blocks
> For Each objBlock In objBlocks
> If objBlock.IsXRef = True Then
> objBlock.Reload
> End If
> Next
>
> causes the same automation error after it iterates through the the blocks
> collection.
>
0 Likes