Document Name using VBA
How to get the Sheet Document Name using VBA?
I am using this code to get the sheet attributes. But I am not getting the Document Name. How can I get the Document Name?
Option Explicit
Dim e3 : Set e3 = CreateObject("CT.Application")
Dim job : Set job = e3.CreateJobObject()
Dim sht : Set sht = job.CreateSheetObject()
Dim att : Set att = job.CreateAttributeObject()
e3.ClearOutputWindow
Dim j, sheetCount, sids
sheetCount = job.GetSheetIds(sids)
e3.PutMessage "There are " & sheetCount & " sheets"
e3.PutMessage ""
For j = 1 to sheetCount
sht.SetId sids(j)
Dim SheetName : SheetName = sht.GetName()
Dim SheetFormat : SheetFormat= sht.GetFormat()
e3.PutMessage "---Sheet Properties ----------------"
e3.PutMessage Left("Sheet Name" & Space(18),18) & ": " & SheetName
e3.PutMessage Left("Format" & Space(18),18) & ": " & SheetFormat
e3.PutMessage Left("IsFormboard" & Space(18),18) & ": " & sht.IsFormboard()
e3.PutMessage Left("IsEmbedded" & Space(18),18) & ": " & sht.IsEmbedded()
e3.PutMessage Left("GetParentSheetId" & Space(18),18) & ": " & sht.GetParentSheetId()
e3.PutMessage ""
e3.PutMessage "---Sheet Schematic Types -----------"
Dim k, typeCount, arrTypes
typeCount = sht.GetSchematicTypes(arrTypes)
For k = 1 to typeCount
e3.PutMessage Left(k & ". " & Space(5), 5) & Left("Schematic Type" & Space(25),25) & ": " & arrTypes(k)
Next
e3.PutMessage ""
e3.PutMessage "---Sheet Attributes ----------------"
Dim m, attCount, attIds
attCount = sht.GetAttributeIds(attIds)
e3.PutMessage "There are " & attCount & " sheet attributes"
For m = 1 to attCount
att.SetId attIds(m)
e3.PutMessage Left(m & ". " & Space(5), 5) & Left(att.GetName & Space(25), 25) & ": " & att.GetValue
Next
Next
Set job = Nothing
Set e3 = Nothing
Was this Helpful?
0
-
I'd like to help, but I'm unclear what you would expect in Document Name.
Can you expand by adding a screen shot showing the desired output?
Regards,
C(1)G
Was this Helpful?
0
Please sign in to leave a comment.
Comments
1 comment