Laime
Laime

Reputation: 21

Visio Shape Data - The Document level

When I create a Shape Data field on the Document Shapesheet how can I pull these Shape Data for the Document jsut like how I can do it for the page and a specific shape?

Document ShapeSheet window

I know I can use TheDoc! to pull User-Defined Cells and shape data, but I wanted to see if I can use the Shape Data instead.

This is an example of what I want to produce.

enter image description here

Upvotes: 1

Views: 621

Answers (2)

Vince
Vince

Reputation: 499

While directly accessing Document-level ShapeData isn't possible without jumping through some hoops, you can spoof it by using the SETATREF() function to "link" the cells to the PageSheet or a dedicated Shape. Example:

ThePage!Prop.Row_1.Label = TheDoc!Prop.Row_1.Label
ThePage!Prop.Row_1 = SETATREF(TheDoc!Prop.Row_1)
...

You may also want to prepend the Label with "Doc_" or something to make it clear to the user.

Upvotes: 0

Surrogate
Surrogate

Reputation: 1734

How do this via user interface

You must open document shapesheet window (urgent) and press Shape Data button How documents shape data

How do this via code

Just run this routine

Sub CallCustomData()
On Error Resume Next ' without this line there will be an error if the date is not changed
Dim aw As Window ' the variable associated with the active window
Set aw = ActiveWindow ' the assignment to the variable associated with the active document window
Dim cl As Cell, wn As Window ' 
Set wn = ActiveDocument.DocumentSheet.OpenSheetWindow ' Open the document properties window
wn.WindowState = visWSMinimized ' minimize the document properties window
wn.Activate ' make the document properties window active
Set cl = ActiveDocument.DocumentSheet.Cells("Prop.row_1") ' the cell with the stored date
cl.Application.DoCmd (1312) ' call the Shape Data window
aw.Activate ' bring focus back to the active document window
wn.Close ' closing the document properties window
aw.WindowState = visWSMaximized ' restoring the size of the active document window
End Sub

Upvotes: 0

Related Questions