Hướng dẫn hard coding excel examples - ví dụ excel mã hóa cứng

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

ProtectedViewWindow.Edit method [Excel]

  • Bài viết
  • 09/13/2021
  • 2 phút để đọc

Trong bài viết này

Opens the workbook that is open for editing in the specified Protected View window.

Syntax

expression.Edit [WriteResPassword, UpdateLinks]Edit [WriteResPassword, UpdateLinks]

expression A variable that represents a ProtectedViewWindow object.ProtectedViewWindow object.

Parameters

NameRequired/OptionalData typeDescription
WriteResPassword Optional Variant The password required to write to a write-reserved workbook. If this argument is omitted and the workbook requires a password, the user will be prompted for the password.
UpdateLinks Optional Variant The password required to write to a write-reserved workbook. If this argument is omitted and the workbook requires a password, the user will be prompted for the password.

UpdateLinks

Specifies the way that external references [links] in the file, such as the reference to a range in the Budget.xls workbook in the following formula =SUM[[Budget.xls]Annual!C10:C25], are updated.

Giá trị trả về

Sách bài tập

Nhận xét

Tránh sử dụng mật khẩu được mã hóa cứng trong các ứng dụng của bạn. Nếu một mật khẩu được yêu cầu trong một quy trình, hãy yêu cầu mật khẩu từ người dùng, lưu trữ trong một biến và sau đó sử dụng biến trong mã của bạn.

Bạn có thể chỉ định một trong các giá trị, được liệt kê trong bảng sau, trong tham số Updatelinks để xác định xem các tài liệu tham khảo bên ngoài [liên kết] có được cập nhật khi mở sổ làm việc hay không.

Giá trịSự mô tả
0 Tài liệu tham khảo bên ngoài [liên kết] sẽ không được cập nhật khi sổ làm việc được mở.
3 Tài liệu tham khảo bên ngoài [liên kết] sẽ được cập nhật khi sổ làm việc được mở.

Thí dụ

Ví dụ mã sau đây mở sổ làm việc được mở trong cửa sổ Chế độ xem được bảo vệ hoạt động để chỉnh sửa.

Dim pvWbk As Workbook 
 
Set pvWbk = ActiveProtectedViewWindow.Edit 

Hỗ trợ và phản hồi

Có câu hỏi hoặc phản hồi về VBA văn phòng hoặc tài liệu này? Vui lòng xem hỗ trợ và phản hồi của Office VBA để được hướng dẫn về cách bạn có thể nhận được hỗ trợ và cung cấp phản hồi.

Chuyển đến nội dung chính

Trình duyệt này không còn được hỗ trợ nữa.

Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.

IconSet object [Excel]

  • Bài viết
  • 09/13/2021
  • 2 phút để đọc

Trong bài viết này

Represents a single set of icons that are used in an icon set conditional formatting rule.

Remarks

The IconSet object is a child object of the IconSets collection.IconSet object is a child object of the IconSets collection.

The icon set for the conditional format is assigned by using the IconSet property of the IconSetCondition object. You set this property to one of the built-in icon sets by passing one of the constants of the XlIconSet enumeration as an index of the IconSets property of the Workbook object. See the example for details.IconSet property of the IconSetCondition object. You set this property to one of the built-in icon sets by passing one of the constants of the XlIconSet enumeration as an index of the IconSets property of the Workbook object. See the example for details.

Example

The following code example creates a range of numbers representing test scores, and then applies an icon set conditional formatting rule to that range. The type of icon set is then changed from the default icons to a 5-arrow icon set. Finally, the threshold type is modified from percentile to a hard-coded number.

Sub CreateIconSetCF[] 
 
 Dim cfIconSet As IconSetCondition 
 
 'Fill cells with sample data from 1 to 10 
 With ActiveSheet 
 .Range["C1"] = 55 
 .Range["C2"] = 92 
 .Range["C3"] = 88 
 .Range["C4"] = 77 
 .Range["C5"] = 66 
 .Range["C6"] = 93 
 .Range["C7"] = 76 
 .Range["C8"] = 80 
 .Range["C9"] = 79 
 .Range["C10"] = 83 
 .Range["C11"] = 66 
 .Range["C12"] = 74 
 End With 
 
 Range["C1:C12"].Select 
 
 'Create an icon set conditional format for the created sample data range 
 Set cfIconSet = Selection.FormatConditions.AddIconSetCondition 
 
 'Change the icon set to a 5-arrow icon set 
 cfIconSet.IconSet = ActiveWorkbook.IconSets[xl5Arrows] 
 
 'The IconCriterion collection contains all of IconCriteria 
 'By indexing into the collection you can modify each criteria 
 
 With cfIconSet.IconCriteria[1] 
 .Type = xlConditionValueNumber 
 .Value = 0 
 .Operator = 7 
 End With 
 With cfIconSet.IconCriteria[2] 
 .Type = xlConditionValueNumber 
 .Value = 60 
 .Operator = 7 
 End With 
 With cfIconSet.IconCriteria[3] 
 .Type = xlConditionValueNumber 
 .Value = 70 
 .Operator = 7 
 End With 
 With cfIconSet.IconCriteria[4] 
 .Type = xlConditionValueNumber 
 .Value = 80 
 .Operator = 7 
 End With 
 With cfIconSet.IconCriteria[5] 
 .Type = xlConditionValueNumber 
 .Value = 90 
 .Operator = 7 
 End With 
 
End Sub

Properties

  • Application
  • Count
  • Creator
  • ID
  • Item
  • Parent

See also

  • Excel Object Model Reference

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Bài Viết Liên Quan

Chủ Đề