Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joe,
Here is some code to generate a GUID Private Type GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(7) As Byte End Type Private Declare Function CoCreateGuid Lib "OLE32.DLL" (pGuid As GUID) As Long Public Function getGUID(Optional delimited As Boolean = False) As String Dim udtGUID As GUID If (CoCreateGuid(udtGUID) = 0) Then getGUID = _ String(8 - Len(Hex$(udtGUID.Data1)), "0") & Hex$(udtGUID.Data1) & _ String(4 - Len(Hex$(udtGUID.Data2)), "0") & Hex$(udtGUID.Data2) & _ String(4 - Len(Hex$(udtGUID.Data3)), "0") & Hex$(udtGUID.Data3) & _ evalChar(udtGUID.Data4(0)) & Hex$(udtGUID.Data4(0)) & _ evalChar(udtGUID.Data4(1)) & Hex$(udtGUID.Data4(1)) & _ evalChar(udtGUID.Data4(2)) & Hex$(udtGUID.Data4(2)) & _ evalChar(udtGUID.Data4(3)) & Hex$(udtGUID.Data4(3)) & _ evalChar(udtGUID.Data4(4)) & Hex$(udtGUID.Data4(4)) & _ evalChar(udtGUID.Data4(5)) & Hex$(udtGUID.Data4(5)) & _ evalChar(udtGUID.Data4(6)) & Hex$(udtGUID.Data4(6)) & _ evalChar(udtGUID.Data4(7)) & Hex$(udtGUID.Data4(7)) End If If delimited Then getGUID = Left(getGUID, 8) & "-" & _ Mid(getGUID, 9, 4) & "-" & _ Mid(getGUID, 13, 4) & "-" & _ Right(getGUID, Len(getGUID) - 17) End If End Function Private Function evalChar(char) evalChar = IIf(char < &H10, "0", "") End Function Here's a function to get the Doc props '----------------------------------------------------------------- Public Function DocumentProperty(Property As String) '----------------------------------------------------------------- Dim oProperty As DocumentProperty Dim CustomProperty As Boolean On Error GoTo dp_error: CustomProperty = True For Each oProperty In ActiveWorkbook.BuiltinDocumentProperties If LCase(oProperty.Name) = LCase(Property) Then CustomProperty = False End If Next If CustomProperty Then DocumentProperty = ActiveWorkbook.CustomDocumentProperties(Property) Else DocumentProperty = ActiveWorkbook.BuiltinDocumentProperties(Property) End If Exit Function dp_error: DocumentProperty = CVErr(xlErrValue) End Function Use like = documentproperty("Last Save Time") -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Joe" wrote in message ... I'm using XL 2002 and would like to retrieve a GUID from the system. Does anyone know an API call that I can use? I would also like to access the document properties. Does anyone know the VBA required to do so. Thanks, Joe |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Document Properties | Excel Discussion (Misc queries) | |||
How do I unlock document properties? | Excel Discussion (Misc queries) | |||
Properties of a document, help! | Excel Worksheet Functions | |||
Document Properties | Excel Worksheet Functions | |||
How retrieve GUID and Document Properties | Excel Programming |