CustomDocumentProperties bao gồm những thuộc tính mà bạn thêm vào. Mặc định thì bên trong chẳng có gì cả, chỉ khi bạn thêm gì đó vào thì nó mới tồn tạiCác bác cho em hỏi thuộc tính Workbook.CustomDocumentProperties có ý nghĩa gì ạ? Có thể cho em 1 ví dụ cụ thể được không ạ? Em tìm trên goole mà tiếng anh kém quá, google dịch chẳng hiểu gì cả
Như đã nói ở trên thì các thuộc tính này chỉ tồn tại khi bạn thêm vàoEm tìm trên Excel help thì được giải thích như thế này:
Vậy "Complete" là tên 1 thuộc tính của DocumentProperties ạ? DocumentProperties có các thuộc tính nào nữa ạ? Mong các bác giải thích giúp em với
Sub SetDocPro()
Dim docProObject As DocumentProperties
Dim docProType As MsoDocProperties
Set docProObject = ThisWorkbook.CustomDocumentProperties
docProType = msoPropertyTypeString
docProObject.Add Name:="Ten cua tui", LinkToContent:=False, Type:=docProType, Value:="Nguyen Anh Tuan"
End Sub
Sub GetDocPro()
MsgBox ThisWorkbook.CustomDocumentProperties("Ten cua tui")
End Sub
Sub DelDocPro()
ThisWorkbook.CustomDocumentProperties("Ten cua tui").Delete
End Sub
Cảm ơn bác rất nhiều ạ.CustomDocumentProperties bao gồm những thuộc tính mà bạn thêm vào. Mặc định thì bên trong chẳng có gì cả, chỉ khi bạn thêm gì đó vào thì nó mới tồn tại
------------
Như đã nói ở trên thì các thuộc tính này chỉ tồn tại khi bạn thêm vào
Ví dụ cụ thể
1> Thêm 1 thuộc tính
2> Đọc thuộc tính vừa thêm:Mã:Sub SetDocPro() Dim docProObject As DocumentProperties Dim docProType As MsoDocProperties Set docProObject = ThisWorkbook.CustomDocumentProperties docProType = msoPropertyTypeString docProObject.Add Name:="Ten cua tui", LinkToContent:=False, Type:=docProType, Value:="Nguyen Anh Tuan" End Sub
3> Xóa thuộc tính đã thêm:Mã:Sub GetDocPro() MsgBox ThisWorkbook.CustomDocumentProperties("Ten cua tui") End Sub
-------------Mã:Sub DelDocPro() ThisWorkbook.CustomDocumentProperties("Ten cua tui").Delete End Sub
Sau khi bạn thêm CustomDocumentProperty vào rồi, bạn có thể thấy nó ở:
- Vào File\Info, bấm mũi tên xổ xuống của mục Properties, chọn Advanced Properties
View attachment 197133
- Cửa sổ Properties hiện ra, chuyển sang tab Custom sẽ thấy các mục thêm vào:
View attachment 197134