|
target sheet drawing from excel
it is possible to target a sheet drawing located under this path c:\test\drawing a.slddrw from excel cells. this drawing file has 40 sheets.
for example, if i type in the cell "a1" sheet1 i want to target the sheet1
if i type in the cell "a1" sheet2 i want to target the sheet2.
i have already the statement to open the sw drawing file. i just want it to target it accordinally my selecting in the excel cell as i mentiond above.
thanks in advance.
maperalia
on your cell value changed event...
swdrawingdoc.activatesheet range("a1")
luke;
thanks for your quick response and the statement. it is working perfectly!!!!!
kind regards.
maperalia
luke;
i so sorry to bother you again. however, i thought the code was running properly. in fact i was using two sheets (sheet1 and sheet11). and i got confuse.
the fact, is the now i have the "sheet 1" and the "sheet 2" in sw drawing. i typed in the cell "a1" "sheet 2" and it is not targeting the sheet selected. it always target the "sheet 1". (see code below as a reference).
kind regards.
maperalia
'@@@@@@@@@@@@@@@@@@@@@@@@@@
set swapp = application.sldworks
set swapp = getobject("sldworks.application")
set part = swapp.activedoc
set drawing = swapp.opendoc("c:\paper\blue.slddrw", swdocdrawing)
swdrawingdoc.activatesheet range("a1")
@@@@@@@@@@@@@@@@@@@@@@@@@@
there are many things wrong with that code segment.
firstly, you attempt to set the swapp using application.sldworks, which will only work from within solidworks macros. then below you try with getobject with a missing syntax so this would not work at all. then you set a variable called drawing to the drawing document, but after try to access a variable called swdrawingdoc. to fix it do this:
dim swapp as sldworks.sldworks
dim drawing as drawingdoc
set swapp = getobject(, "sldworks.application")
set drawing = swapp.activedoc
' or set drawing = swapp.opendoc("c:\paper\blue.slddrw", swdocdrawing)
drawing.activatesheet range("a1")
luke;
thanks very much. the code you sent me is working perfectly!!!!!
kind regards.
maperalia
quick |
|