返回列表 上一主題 發帖

二個巨集程式問題

二個巨集程式問題

1.請問我的巨集程式中有很多個CommandButton (1   2    3),每個CommandButton下面都有個別巨集程式
現在我要做一個CommandButton4 執行後可以依序執行CommandButton1→CommandButton2→CommandButton3巨集程式?
(在不使用到模組的情況下)
2.如何設計巨集程式來自動啟動excel 樞紐分析表中"更新資料"的功能
以上請各位先進協助~~謝謝

1.請問我的巨集程式中有很多個CommandButton (1   2    3),每個CommandButton下面都有個別巨集程式,現在我要做一個CommandButton4 執行後可以依序執行commandButton1→CommandButton2→CommandButton3巨集程式?(在不使用到模組的情況下)
針對第一個問題是指再同一個檔案內
但如果再不同檔案時要如何設定呢

TOP

oobird 老師
我是指已經用巨集(excel檔案B)來開啟一個excel檔案A
但要
如何用excel檔案B中的commandButton1
去執行excel檔案A中的commandButton1

TOP

Private Sub CommandButton1_Click()
Application.Calculation = xlCalculationManual '手動計算
Workbooks.Open Filename:="C:\Documents and Settings\k1489.KT_DOMAIN\桌面\李鎮江\02_技師保母\02_技師保母成效_程式.xls"  '開檔
Run "02_技師保母成效_程式.xls!Sheets(程式).CommandButton7_Click"
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveSheet.Calculate
End Sub

好像不行耶

TOP

oobird老師
用這樣去跑會出現"陣列索引超出範圍"

TOP

是指shee1(程式)
Workbooks("02_技師保母成效_程式.xls").Sheet1.CommandButton7_Click

TOP

抱歉~~剛剛傳錯了~~
改成如此後測試已正常~~感恩
Run "02_技師保母成效_程式.xls!Sheet1.CommandButton7_Click"

TOP

        靜思自在 : 站在半路,比走到目標更辛苦。
返回列表 上一主題