Accessing the Application Options User Name from VB

Accessing the Application Options User Name from VB

Anonymous
Not applicable
651 Views
2 Replies
Message 1 of 3

Accessing the Application Options User Name from VB

Anonymous
Not applicable

How can I access the Username that is in Inventor's Application Options \ General Tab?

 

I have written some code to add initials and today's date to the Checked By, Checked Date fields.  I currently have it entering a static value but would like to roll it out to other users.

 

This is what I currently have:

 

 

Public Sub SetCheckedByiProperty()
    ' Get the active document.
    Dim oDoc As Document
    Set oDoc = ThisApplication.ActiveDocument

    ' Get the PropertySets object.
    Dim oPropSets As PropertySets
    Set oPropSets = oDoc.PropertySets

    ' Get the design tracking property set.
    Dim oPropSet As PropertySet
    Set oPropSet = oPropSets.Item("Design Tracking Properties")

    ' Get the Checked By iProperty.
    Dim oCheckedByiProp As Property
    Set oCheckedByiProp = oPropSet.Item("Checked By")

    ' Set the Checked By iProperty.
    oCheckedByiProp.Value = "RSM"
   
    ' Get the Date Checked iProperty.
    Dim oDateCheckediProp As Property
    Set oDateCheckediProp = oPropSet.Item("Date Checked")
   
    ' Set the Date Checked iProperty.
    oDateCheckediProp.Value = Now
   
    ' Save the drawing.
    oDoc.Save
   
End Sub

 

 

I need to pull the value entered in the Application Options User Name and use it in place of 'RSM' above.

 

 

Thanks,

Randy Mabery

Autodesk Inventor Professional 2009 SP2
Autodesk Productstream 2009
Intel i5 3.2GHz
7GB Ram
NVIDIA Quadro FX 1800

0 Likes
Accepted solutions (1)
652 Views
2 Replies
Replies (2)
Message 2 of 3

sanjay.ramaswamy
Alumni
Alumni
Accepted solution

ThisApplication.GeneralOptions.UserName

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Sanjay,

 

That worked great! 

 

Thanks,

Randy

 

 

0 Likes