Results 1 to 3 of 3

Thread: 'Autocad main window is invisible ' error

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2015-07
    Posts
    1
    Login to Give a bone
    0

    Default 'Autocad main window is invisible ' error

    Hi,
    I have recently started to create objects within Autocad using VBA within an Excel spreadsheet.

    In this instance I have a control spreadsheet where the user specifies an external spreadsheet to open and get data from. I want to use VBA to instruct Autocad to create various layers and objects within the file autocad currently has open. The problem is that:

    The control spreadsheet opens and reads the data. It executes the code to create the layers and object but when it comes to execute the command to 'zoomextents' the current autcad view I get the error 'Autocad main window is invisible'. How can I make the autocad file the active object?

    I have attached the vba code I am using...

    Thanks in advance for any assistance with this
    Attached Files Attached Files

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: 'Autocad main window is invisible ' error

    Welcome to AUGI.
    To insert code, click on Go Advanced and use the code tags.
    Code:
    Sub new_vba()
    Dim cad As AcadApplication
    Dim cad_file As AcadDocument
    Dim east_north(0 To 2) As Double
    Dim file_path
    Dim k As Long
    Dim handle, row_no, i, j As Integer
    Dim file_name As Variant
    Dim point_no, counter, counter1 As Integer
    Dim code, dummy, last_layer As String
    Dim east, north As Single
    Dim easts, norths As String
    Dim data_read(1000, 15)
    Dim temp(500, 6)
    Dim layer(100, 2)
    Dim acadcir(0) As AcadCircle
    Dim objnewlayer As AcadLayer
    Dim hatchobject As AcadHatch
    Dim radius As Double
    
    'initialise the data array
    For i = 1 To 1000
    For j = 1 To 14
    data_read(i, j) = ""
    Next j
    Next i
    Unfortunately, there is something about your code that won't allow me to display the rest of it.
    Last edited by Ed Jobe; 2015-07-24 at 08:00 PM.
    C:> ED WORKING....


    LinkedIn

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,420
    Login to Give a bone
    0

    Default Re: 'Autocad main window is invisible ' error

    Maybe this thread will help.
    C:> ED WORKING....


    LinkedIn

Similar Threads

  1. Replies: 3
    Last Post: 2011-12-10, 06:50 PM
  2. Replies: 2
    Last Post: 2011-06-13, 01:40 PM
  3. Invisible Object properties window
    By moshira_hassan in forum AutoCAD General
    Replies: 5
    Last Post: 2007-12-28, 08:19 AM
  4. error : AutoCAD main window is invisible ?
    By toanzeppelin in forum VBA/COM Interop
    Replies: 2
    Last Post: 2005-09-19, 02:07 AM
  5. AutoCAD main window invisible
    By wpeacock in forum VBA/COM Interop
    Replies: 1
    Last Post: 2005-01-13, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •