• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

excel - open a specific sheet with vlisp

  • Thread starter Thread starter Dr.Lube
  • Start date Start date

Dr.Lube

Guest
Hi.
Can someone tell me how to open the spreadsheet I want, not the current one?
Code:
...
		   activesheet
		   (vlax-get-property excel 'activesheet)
...
I searched but I can't find answers. If I don't tell him the sheet I run the risk of importing wrong data while I would like to open the sheet "sign pins". .

Does anyone know the syntax?

Thank you.
 
Thank you for the answer, but it doesn't work. .
Code:
(defun load-excel (/)
		  
		  (setq
		   excel	
		   (vlax-get-or-create-object "excel.application")

		 
		   workbooks
		   (vlax-get-property excel 'workbooks)

		  
		   currworkbook
		   (vlax-invoke-method
		     workbooks
		     'open
		     path ;indirizzo file
		   )

		  
		   ;(vlax-get-property excel 'activesheet)

		    (vlax-get-property excel 'item "disegno spille")
		   
		   
		   cells
		   (vlax-get-property activesheet 'cells)
		   
		  )
)
I also tried to change the objects from which to fish (which should be the currworkbook, to intuition)
(setq
excel
(vlax-get-or-create-object "excel.application"))
#<vla-object 000000002e8f4d48="" _application="">
_1$ (setq
workbooks
(vlax-get-property excel 'workbooks))
#<vla-object 000000002f5975d8="" workbooks="">
_1$ (setq

currworkbook
(vlax-invoke-method
workbooks
'open
path
))
#<vla-object 000000002f5976b8="" _workbook="">

_$ (vlax-get-property excel 'item "disegno spille")
; errore: il server activex ha restituito un errore: nome sconosciuto: item

_$ (vlax-get-property currworkbook 'item "disegno spille")
; errore: il server activex ha restituito un errore: nome sconosciuto: item

_$ (vlax-get-property workbooks 'item "disegno spille")
; errore: errore di automazione. descrizione non fornita.
_1$ </vla-object></vla-object></vla-object>
 
(setq
Fileexcel (fla-open)
(vlax-get-or-create object "excel.application")
'workbooks
)
"nome file excel'
)
fogliodilavoro (vlax-get-property)
(vlax-get-property
fileexcel
Worksheets
)
item
"disegno spille"
)
)
 
Thank you! Now I try it.. I had written this
Code:
(setq excel (vlax-get-or-create object "excel.application")
workbooks (vlax-get-property excel workbooks)
currworkbook
sheets

disegno_spille
(vlax-invoke-method)
(vlax-get-property sheets 'item 4)
'Activate
)

curworksheet (vlax-get-property excel 'activesheet)
cells
)
Are they equivalent or?
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top