Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to set a variable in a macro to the OS User name, so i can call the variable later in the macro and use it to write to a databse... However I'm getting an Object required error... heres my code
set table = ActiveDocument.GetSheetObject("TBComments")
set vUser = ActiveDocument.Variables("vOSUser").GetContent.String
For RowIter = 1 to table.GetRowCount-1
set vKPI = table.GetCell(RowIter,1)
set vMonth = table.GetCell(RowIter,2)
set vMeeting = table.GetCell(RowIter,0)
set vComment = table.GetCell(RowIter,4)
set vKey = table.GetCell(RowIter,3)
All of the variable are set ok, apart from the vUser one, the error i get is Object required: '[string: "ABC"]'
where ABC is the OS username and vOSUser is a variable in the document set to = OSUser()
I've also tried
set vUser = ActiveDocument.Evaluate("OsUser()")
Can anyone advise where I'm going wrong?
Thanks
Matt
try this:
set vUser=ActiveDocument.getvariable("vOSUser")
Greetings
Martin
Hi QQ,
to use this ... vUser = ActiveDocument.Variables("vOSUser").GetContent.String ( set exceed)
good luck, Luis.