Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
This is part of my code that creates an XML with the file name SaleData.xml, because that is the name of my object. According to the code below, sTableID + ".xml is making that happen, I get that part; and it works fine.
In the object there is field called ntDomain, which has different values; but only one for each user at a time as they are viewing my dashboard. I need the xml file name to be what’s the ntDomain name, not the object name.
So for example, the ntDomain for me is American/kjenkins. As I view the dashboard, kjenkins is selected through the way the security is done. I need the file name to be kjenkins.xml or Americas.kjenkins.xml.
Is this possible, can someone help me with this please. I don’t know VB that well at all.
sub saveToFile(sXML, sTableID)
'set the destination where the file is to be created
'sFileName = "../../../QVD/WW/AFP/" + sTableID + ".xml" 'msgbox(sFileName)
set oFile = CreateObject("Scripting.FileSystemObject")
set oTxtStream = oFile.OpenTextFile(sFileName, 2, True)
oTxtStream.Write sXML
'Close the file and clean up
oTxtStream.Close
Set objTextStream = Nothing
Set oFile = Nothing
end sub
'
Is your user always the logged in user you could use:
set temp = ActiveDocument.GetApplication.GetProperties
msgbox(temp.UserName)
If your user a field (or listbox) you could read this so:
set val=ActiveDocument.Fields("User").GetPossibleValues
for i=0 to val.Count-1
msgbox(val.Item(i).Text)
next
- Marcus