Ashish123 Posted May 15, 2019 Posted May 15, 2019 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 Quote
BIGAL Posted May 16, 2019 Posted May 16, 2019 You may need something like this (vlax-release-object myXL)(setq myXL nil) Quote
Ashish123 Posted May 17, 2019 Author Posted May 17, 2019 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. Quote
Recommended Posts
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.