Jump to content

Recommended Posts

Posted

what that message mean

runtime error 94

invalid use of null

 

i use that code to open dwgs files in listbox1

 

Private Sub CommandButton12_Click()

For Each FIL In ListBox1.List

ThisDrawing.Application.Documents.Open (FIL)

Next FIL

End Sub

 

AND LINE WITH COLOR BLUE GIVE THIS ERROR

 

 

CAN ANY ONE HELP ME

Posted

I added a couple of checks to the code. It appears to work. I hope this helps.

 

[color=lime]' Check for an empty list[/color]
[color=blue]If[/color] Me.ListBox1.ListCount <> 0 [color=blue]Then[/color]

   [color=blue]For Each[/color] Fil [color=blue]In[/color] Me.ListBox1.List

[color=lime]       ' Check for nul[/color]
       [color=blue]If [/color]Fil <> nul [color=blue]Then[/color]

           ThisDrawing.Application.Documents.Open (Fil)

       [color=blue]End If[/color]

Next Fil

[color=blue]End If[/color]

Posted

dear dsamc2000 i try what you say but it still give error at same line

 

 

 

thanks for help

Posted

Can Any One Help Me To Solve This Error

Posted

I have tested this in AutoCAD 2008 and 2010 using VBA and it works in both. I will test it on a 2005 system on Monday.

If you are using something other that VBA please let us know.

Posted

dear bsamc2000 iam using vba with autocad 2007

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...