質問: true end with end if next end sub
回答: sub jj() dim aa as worksheet, shp as shape for each aa in sheets if aa.shapes.count > 0 then for each shp in aa.shapes with shp .placement = xlmove .controlformat.printobject = true end with next end if next end sub 2011-08-24 10:20:51 補充: sub jj_2() dim aa as worksheet for each aa in sheets if aa.shapes.count > 0 then with aa.drawingobjects .placement = xlmove .printobject = true end with end if next end sub 2011-08-29 13:34:52 補充: for kubi大: 正解,請上答吧! 主需求:各工作表繞一圈再回原工作表 2011-08-30 11:00:53 補充: excel vba.設定檔案中全部工作表〔物件〕的〔屬性〕 <.准提部林.> ---------------------------------- ■巨集1: 因以〔錄製〕方式取得程式碼,皆免不得會有〔select〕, 故執行時須將各工作表轉換為〔當前視窗〕, 若要跳回原來工作表,則須先設定〔變數〕指定工作表。 (意見001.kubi大的方法) sub 物件屬性設定1() dim xsht as worksheet, xr as range, mysht as worksheet, myrng as range set mysht = activesheet '巨集執行時的工作表 set myrng = activecell '當前儲存格 for each xsht in sheets xsht.select set xr = activecell '各工作表當前儲存格 if xsht.shapes.count > 0 then activesheet.shapes.selectall with selection .placement = xlmove .printobject = true end with xr.select '離開物件的選取,回選當前儲存格 end if next '返回原工作表及儲存格 mysht.activate myrng.select end sub ■巨集2: sub 物件屬性設定2() dim aa as worksheet, shp as shape for each aa in sheets if aa.shapes.count > 0 then for each shp in aa.shapes with shp .placement = xlmove .controlformat.printobject = true end with next end if next end sub ■巨集3: sub 物件屬性設定3() dim aa as worksheet for each aa in sheets if aa.shapes.count > 0 then with aa.drawingobjects .placement = xlmove .printobject = true end with end if next end sub ■使用〔巨集2〕及〔巨集3〕即可避免用到〔select〕,效率較佳。 ----------------------------------