我正在嘗試在更大的事件資料字串中查找檔案路徑。每個事件的檔案路徑和名稱的長度各不相同。例子:
安全 ID:xxxx 帳戶名稱:xxxx 帳戶域:xxxx 物件名稱:c:\temp\MyFile.doc 句柄 ID:xxxx 資源屬性:xxxx
我只想要檔案和路徑 = c:\temp\MyFile.doc 所以我使用 Mid 和 instr 來獲取 Object Name: 和 Handle ID 之間的字串。它的作業原理是在檔案名后仍然保留一些字符。下面是我的功能。
Mid(event,Instr(event,"Object Name: ") 13, InstrRev(event,"Handle ID:") - Len(mid(event,InstrRev(event,"Handle ID:"))))
謝謝你
uj5u.com熱心網友回復:
您可以使用Split兩次:
Text = "Security ID: xxxx Account Name: xxxx Accound Domain: xxxx Object Name: c:\temp\MyFile.doc Handle ID: xxxx Resource Attributes: xxxx"
Path = Split(Split(Text, "Object Name: ")(1), " Handle ID:")(0)
Debug.Print Path
c:\temp\MyFile.doc
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/351154.html
標籤:ms-access
上一篇:AWK位置變數處理
下一篇:使用另一個資料表中的列過濾行
