Quantcast
Viewing all articles
Browse latest Browse all 14319

Code execute diff from VB editor and from a button

Greeting to all!

 

I load my *.dvb file into Acad application using APPLOAD->Startup Suite. Then I put a button on my quick access taskbar with the following syntax: ^C^C_vbarun PageInsert.dvb!Module1.pageinsert.

 

The problem is that when i execute the code from the button it seems that it's not doing what it's supposed to do. Example

      For Each objlayer In ThisDrawing.Layers
      If 0 = StrComp(objlayer.Name, "NONPRINT", vbTextCompare) Then
      ThisDrawing.Layers("NONPRINT").LayerOn = False
      MsgBox "NONPRINT OFF"
      End If
      If 0 = StrComp(objlayer.Name, "NVIEWS", vbTextCompare) Then
      ThisDrawing.Layers("NVIEWS").LayerOn = False
      MsgBox "Nviews OFF"
End If
Next objlayer

I get the MSGBox but the layer is not turned off. Because of that few lines below i select some objects and try to move them and i get the error "On locked Layer". Strange part is when i run the code from VB editor everything is working fine. In both cases i debug the program, it enteres the line to turn off the layer but in one case it's not working. I tried to set focus to the application using Application.VBE.MainWindow.Visible = False but no luck.

Ideas?

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 14319

Trending Articles