Jump to content

Getting Pop up Message to Close All Excel spread sheet while Running Auto Lisp.


Recommended Posts

Posted

Hello All Cad Gurus,

 

i have created a script ( script test attached) that opens my default drawing which has necessary data links. 

What the script does is, it load couple of Auto Lisp codes to perform the specific task. It load the Auto cad test lisp (attached), which opens a specific excel file( which contains the following VBA in it) to update the data links of my default drawing. Then scrip saves the auto cad file with specific name and location and moves on to next line of scrip. 

 

The script works perfectly fine for the first line, but as soon as it reaches the second line of the script, it gives me Pop up message from Auto CAD of " CLOSE ALL SPREAD SHEET TO CONTINUE" even though all the spread sheet and excel is close. 

 

Please take a look and let me know your thoughts. 

 

Your help would be really appreciated. 

 

Thank you.

Ashish

------------------------------------------

Sub Button1_Click()
Dim strFilename As String
Dim strpath As String

Application.DisplayAlerts = False

Worksheets("Sheet1").Activate
Application.DisplayAlerts = False

Worksheets("Sheet2").Activate

Worksheets("Sheet2").Range("$A$3:$L$3").Copy _
    Destination:=Worksheets("Sheet2").Range("$A$2:$L$2")

Worksheets("Sheet2").Range("$A$3:$L$3").Delete Shift:=xlUp
Worksheets("Sheet2").Range("$M$1:$N$1").ClearContents
Application.DisplayAlerts = True
    

Worksheets("Sheet1").Activate
Application.DisplayAlerts = False

ActiveWorkbook.Save

strpath = "H:\AUTOCAD AUTOMATION\"
strFilename = "123" & ".xlsx"

ActiveWorkbook.SaveAs strpath & strFilename, xlOpenXMLWorkbook

ActiveWorkbook.Close

End Sub

 

---------------------------------------
 

SCRIPT test.SCR AUTOCAD test.LSP

Posted

You may need something like this

 

(vlax-release-object myXL)(setq myXL nil)

Posted

Hello Bigal,

 

I found out the problem. Actually i downloaded the GetExcel.lsp from online. In that lsp they have the prompt alert for "Close all Excel Spread Sheets". I removed that particular part and my all script, lsp & VBA works like a charm. 

 

I will still try your suggestion and will see if i can improve the performance of the codes. 

 

Thank you. 

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...