how to add UserName from Properies to Textfield

Started by novski, February 12, 2014, 08:39:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

novski

I wanted to add my Username that is stored in the Properties of Visio 2010 to a Field by using Text Fields, Fieldpicture(37), Creator() in a Shapesheet. But this gives out a Document Properties value.
Is it possible to get the Visio Properies Value "Username" stored under File/options somehow?
thanks for hints.
best regards
novski

Yacine

Is there really a difference between creator and unsername...?
Yacine

Jumpy

Afaik the creator will always be the name of the one that created the template. Not the one that created a drawing based on that template.
I had problems with that, too. I used VBA in DocumentCreated event to push the name of the current user, that creates the drawing, in a ShapeSheet cell of the document or page.

wapperdude

But if you have document properties set to show on 1st save, you can enter the author of the document and then save.  Once saved, I think this name gets retrieved as creator, which is accessed by the insert>field>document info>creator.  (Actually, you can change the File>properties>author at any time and the insert field will update.)  This should overwrite the name of the original template creator.  Seemed to work for me.  V2007.  If you don't set the document properties, then, the author may not inherit the correct name.

HTH
Wapperdude


Visio 2019 Pro

novski

does not work on Visio 2010. Creator stays the Creator of the Template. All trough Microsoft explanes it like it shod. Maybe its a Bug. http://msdn.microsoft.com/en-us/library/office/ms406658%28v=office.12%29.aspx

Jumpy

Just to clarify my  last post. You can manually change the creator and in the document properties and that will be pushed to shapes using the creator() shapesheet function. That's OK. But what I wanted to say is, that the creator doesn't change automatically when you create a drawing based on a template. The creator of the template stays the creator of the drawing unless / until changed manually.

That is different from Word or Excel so I got iritated with that.

wapperdude

Being irritated with V2010  :o ...completely understand!!!   8)
Visio 2019 Pro

Yacine

This seems to work (to save in the document's macros of the template):
Private Sub Document_DocumentCreated(ByVal doc As IVDocument)
    doc.Creator = Environ("USERNAME")
End Sub

It will run once, when your user will create a new drawing from the template.
Yacine

novski