2012-10-18 23 views
1

我想從數據驗證中刪除幫助按鈕。 在Excel 2003中的數據驗證這個按鈕不存在,但現在我想從Excel 2007數據驗證錯誤中刪除此。 請不要問爲什麼你想刪除幫助按鈕。從excel數據驗證中刪除幫助按鈕

我的項目類型的Visual Studio 2008

SS of data validation error of excel 2007

編輯

是否有任何其他的方式來從Worksheet_Change除了完成這件事情的Excel模板?我認爲這可能會降低性能。

回答

4

如果您使用內置的數據驗證,則無法刪除幫助按鈕。建議您只使用幫助按鈕,因爲唯一已知的解決方法將耗費時間來重新創建Excel的內置功能。

您需要製作一個自定義msgbox來監聽工作表變更並檢查值。這裏有一個VBA示例basically taken from here

Private Sub Worksheet_Change(ByVal Target As Range) 
dim msg as string 
dim Style as string 
dim Title as string 
dim Response as long 
'Update Cells to be the actuall range you want to validate 
If Intersect(Target, Cells(1, 2)) Then 
    If Cells(1, 2).Value <> "whatever" Then 
     msg = "Value must be LT 1" 
     Style = vbRetryCancel + vbCritical 
     Title = "Mt Error" 
     Response = MsgBox(msg, Style, Title) 
    End If 
End If 
End Sub 
+0

我編輯了一個問題,可以請檢查一下。請根據這個給我解決方案。 –

+1

@TusharChhabhaiya:解決方案是在共享鏈接 - 不要這樣做。 Excel在幕後執行的許多事情不可能通過Excel對象庫進行復制。 –