Woah, you are so far down the rabbit hole...
Okay, the code you are looking at is getting you a view on the SharePoint list, which maybe not the best place to start, but the fact that it is all being done in VBA makes it really hard. I have .NET C# code to query a list and retrieve the items that have a particular value. The VBA conversion I am not able to do.
public static string GetPageId(string listName, string webPath, string pageTitle)
{
string pageId = "";
IntranetLists.Lists lists = new IntranetLists.Lists();
lists.UseDefaultCredentials = true;
lists.Url = webPath + "/_vti_bin/lists.asmx";
XmlDocument doc = new XmlDocument();
doc.LoadXml("<Document><Query><Where><Contains><FieldRef Name=\"Title\" /><Value Type=\"Text\">" + pageTitle + "</Value></Contains></Where></Query><ViewFields /><QueryOptions /></Document>");
XmlNode listQuery = doc.SelectSingleNode("//Query");
XmlNode listViewFields = doc.SelectSingleNode("//ViewFields");
XmlNode listQueryOptions = doc.SelectSingleNode("//QueryOptions");
Guid g = GetWebID(webPath);
XmlNode items = lists.GetListItems(listName, string.Empty, listQuery, listViewFields, string.Empty, listQueryOptions, g.ToString());
foreach (XmlNode listItem in SPCollection.XpathQuery(items, "//sp:listitems/rs:data/z:row"))
{
XmlAttribute id = listItem.Attributes["ows_Id"];
if (id != null)
{
pageId = id.Value;
}
}
return pageId;
}
The IntranetLists is a .net web reference to the lists.asmx file.
You will have to research how to use the lists.asmx web service from within VBA,
you will then have to call GetListItems with a query that represents the column value you want to look up.
<Where><Contains><FieldRef Name="Title" /><Value Type="Text">MyValue</Value></Contains></Where>
The syntax for that query is CAML
then you are going to have to parse the xml that comes back to find the item and the item field with the value you require.
Any xpath query is going to have to have the correct namespaces added, e.g.
public static XmlNodeList XpathQuery(XmlNode xmlToQuery, string xPathQuery)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlToQuery.OuterXml);
XmlNamespaceManager mg = new XmlNamespaceManager(doc.NameTable);
mg.AddNamespace("sp", "http://schemas.microsoft.com/sharepoint/soap/");
mg.AddNamespace("z", "#RowsetSchema");
mg.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
mg.AddNamespace("y", "http://schemas.microsoft.com/sharepoint/soap/ois");
mg.AddNamespace("w", "http://schemas.microsoft.com/WebPart/v2");
mg.AddNamespace("d", "http://schemas.microsoft.com/sharepoint/soap/directory");
return doc.SelectNodes(xPathQuery, mg);
}
However I am not sure you would even have access to something that would parse xml within your VBA setup, so you may have to download some extra VBA tool for doing that - may even be blocked for you.
Hope this helps a little.