'BEGIN DESCRIPTION 'Add an extension to all variable names. 'END DESCRIPTION ' Posted by Jon Peck to SPSSX-L list on 2003/11/03 Option Explicit Sub Main Const SUFFIX= "_suffix" ' get variables Dim objDataDoc As ISpssDataDoc Dim objDocuments As ISpssDocuments Set objDocuments = objSpssApp.Documents Dim varList As Variant, newlist As Variant, oldlist As Variant Dim i As Long ' get the dictionary Set objDataDoc = objDocuments.GetDataDoc(0) ' Get the variables varList = objDataDoc.GetVariables (False) ' Iterate through the array of variables For i = LBound(varList) To UBound(varList) oldlist = oldlist & " " & varList(i) newlist = newlist & " " & varList(i) & SUFFIX Next i objSpssApp.ExecuteCommands "RENAME VARIABLES (" & oldlist & "=" & newlist & ").", _ False 'run cmd asynchronously End Sub