- 帖子
- 95
- 主題
- 29
- 精華
- 0
- 積分
- 150
- 點名
- 0
- 作業系統
- windows2003
- 軟體版本
- office 2003
- 閱讀權限
- 20
- 性別
- 男
- 來自
- Kaoshiung
- 註冊時間
- 2010-11-5
- 最後登錄
- 2018-2-8
|
[發問] 請教:如何在使用activesheet後,再限制特定工作表不執行程式
本帖最後由 GBKEE 於 2013-1-14 15:40 編輯
Dear :
小弟修正於各工作表上執行圖片放大縮小動作,因工作表數視載入檔案多少不一定,但因其有二頁工作表不需做其圖片放大縮小動作,不知要如何修正,請各位大大幫忙指引一下迷津,感恩!- Private Sub Workbook_Open()
- Set dic = CreateObject("Scripting.Dictionary")
- Dim Sh As Shape
- Dim SHT As Worksheet
- Dim DaSht As String, CALSht As String
- DaSht = "DashBoard": CALSht = "CALS" ' 這二個工作表不做shape放大縮小動作
- For Each SHT In Sheets
- Do While SHT Is Nothing
- If SHT.Name = DaSht Or SHT.Name = CALSht Then
- Exit Do
- Else
- For Each Sh In SHT.Shapes ' 連同註解的文字方塊或圖表也會被認為是shape,開檔案時會alert
- With Sh
- Sh.OnAction = "nn"
- dic(Sh.Name & "h") = Sh.Height
- dic(Sh.Name & "w") = Sh.Width
- End With
- Next
- End If
- Loop
- Next
-
- End Sub
- Sub nn()
- With ActiveSheet.Shapes(Application.Caller)
- '---變更為在自己的位置作放大縮小的動作
- If .Height <> dic(.Name & "h") Then
- .Height = dic(.Name & "h")
- .Width = dic(.Name & "w")
- Else
- .Height = dic(.Name & "h") * 8
- .Width = dic(.Name & "w") * 8
- .ZOrder msoBringToFront
- End If
- End With
- End Sub
複製代碼
Question_20130114.zip (94.89 KB)
|
|