Excel load error

Excel load error

Anonymous
Not applicable
925 Views
3 Replies
Message 1 of 4

Excel load error

Anonymous
Not applicable

 I'm not sure why I'm getting this error now as this part of the coding has not been changed and it was working fine yesterday. 

 

This is the file I'm loading and the error from the text box and the lisp code:

 

ldfl : C:/3D Storage Tank Generator/FRP Excel Data Sheets/FRP Tank Design data Internals.xlsm
; error: Automation Error. Sorry, we couldn't find C:\//3D%20Storage%20Tank%20Generator/FRP%20Excel%20Data%20Sheets/FRP%20Tank%20Design%20data%20Internals.xlsm. Is it possible it was moved, renamed or deleted?

     (fileselect
       "C:/3D Storage Tank Generator/FRP Excel Data Sheets"
       '("*.xls" "*.xlsm")
     )
     (setq ldfl (car File_List))

  (prompt "\n")
  (princ "ldfl : ")
  (princ ldfl)
  (prompt "\n")
     
     (cond
       (
	(/= File_List nil)
	(setq xl (vlax-get-or-create-object "Excel.Application"))
	(vlax-invoke-method
	  (vlax-get-property xl 'WorkBooks)
	  'Open
	  ldfl
	)
	(setq mbk (vl-catch-all-apply
		    'vla-open
		    (list (vlax-get-property xl "WorkBooks")
			  ldfl
		    )
		  )
	)

 The error occurs at the 'Open

0 Likes
Accepted solutions (1)
926 Views
3 Replies
Replies (3)
Message 2 of 4

dmfrazier
Advisor
Advisor

"Sorry, we couldn't find C:\//3D%20Storage..."

 

Backslash, followed by two foreslashes?

0 Likes
Message 3 of 4

Anonymous
Not applicable

I thought that was the problem as well that's why I added the print out of ldfl which turned out to be ok. 

0 Likes
Message 4 of 4

Anonymous
Not applicable
Accepted solution

Ok I found a solution to this by add in the line :  (setq ldfl (findfile ldfl))

 

     (setq ldfl (findfile ldfl))
     (cond
       (
	(/= File_List nil)
	(setq xl (vlax-get-or-create-object "Excel.Application"))
	(vla-put-visible xl :vlax-true)				;hide application from view
	(vlax-put-property xl 'DisplayAlerts :vlax-true)	;hide Excel alerts
	(vlax-invoke-method
	  (vlax-get-property xl 'WorkBooks)
	  'Open
	  ldfl
	)
	(setq mbk (vl-catch-all-apply
		    'vla-open
		    (list (vlax-get-property xl "WorkBooks")
			  ldfl
		    )
		  )
	)

Not sure why all of a sudden it stopped working but by adding this line of code fixed it.

 

0 Likes