私が書こうとしているコードの疑似コードは次のとおりです。
Open WWID Exclusion List (csv file)
Open XML File
For Each WWID (WorldwideID) search and see if it is in the XML record
IF EMPLOYEE found delete the EMPLOYEE XML
Save text File
Close text file
以下に示すような構造の XML ファイルがあります。
<EMPLOYEE>
<WWID><![CDATA[10000001]]></WWID>
<EFFDT><![CDATA[06/02/2009]]></EFFDT>
<ACTION><![CDATA[]]></ACTION>
<ACTION_REASON><![CDATA[]]></ACTION_REASON>
<EMPL_CLASS><![CDATA[E]]></EMPL_CLASS>
<LOCATION><![CDATA[SC2]]></LOCATION>
<FIRST_NAME><![CDATA[FirstName]]></FIRST_NAME>
<LAST_NAME><![CDATA[LastName]]></LAST_NAME>
<MI><![CDATA[S]]></MI>
<NICKNAME><![CDATA[]]></NICKNAME>
<MGR_WWID><![CDATA[10000002]]></MGR_WWID>
<COST_CENTER><![CDATA[55555]]></COST_CENTER>
<EMPL_STATUS><![CDATA[R]]></EMPL_STATUS>
<HIRE_DT><![CDATA[02/09/1987]]></HIRE_DT>
<REHIRE_DT><![CDATA[]]></REHIRE_DT>
<TERMINATION_DT><![CDATA[06/01/2000]]></TERMINATION_DT>
<TITLE><![CDATA[Software Developer]]></TITLE>
<SHIFT><![CDATA[1]]></SHIFT>
<ORGUNIT><![CDATA[11111]]></ORGUNIT>
<FLSA><![CDATA[E]]></FLSA>
</EMPLOYEE>
これまでのコーディングの進捗状況:
Sub Purge_Old_Records()
Dim sBuf As String
Dim sXMLBuf As String
Dim sTemp As String
Dim sXMLTemp As String
Dim iFileNum As Integer
Dim iXMLFileNum As Integer
Dim sFileName As String 'Name of exclusion file to Open
Dim sXMLFileName As String ' Name of XML file
' Select the XML & Exclusion files
sXMLFileName = Application.GetOpenFilename(FileFilter:="Data Files (*.xml), *.xml, All Files(*.*), *.*", Title:="Select XML File")
sFileName = Application.GetOpenFilename(FileFilter:="Data Files (*.csv), *.csv, All Files(*.*), *.*", Title:="Select Exclusion File")
'Open & read XML file first
iXMLFileNum = FreeFile
Open sXMLFileName For Input As iXMLFileNum
Do Until EOF(iXMLFileNum)
Line Input #iXMLFileNum, sXMLBuf
sXMLTemp = sXMLTemp & sXMLBuf & vbCrLf
Loop
Close iXMLFileNum
'Open Exclusion List Second
iFileNum = FreeFile
Open sFileName For Input As iFileNum
Do Until EOF(iFileNum)
Line Input #iFileNum, sBuf
sTemp = sTemp & sBuf & vbCrLf
Loop
Close iFileNum
WWID を見つけて EMPLOYEE レコード全体を消去するだけでなく、消去するためのコーディング方法についてヘルプが必要
sTemp = Replace(sTemp, "DIM A", vbCrLf)
'Save Revise file TXT file
iFileNum = FreeFile
sFileName = Application.GetSaveAsFilename(Title:="Select Output XML Filename")
Open sFileName For Output As iFileNum
Print #iFileNum, sTemp
Close iFileNum
End Sub
助けてくれてどうもありがとう!