It’s possible in VBA, but you won't get much support. As far as I know, SolidWorks doesn't offer VBA examples on this topic. I suggest to deal with .NET. If you know VBA, switching to VB.NET shouldn't be difficult. An example of SolidWorks for GetComputedBOM and GetDerivedBOMs can be found here:
If C# doesn't scare you off, you can download the source code of an add-in from my homepage, which reads any variable and the BOM for an item and saves it as XML file. It can be found under Downloads -> Mini Add-In for exporting PDM variables and BOMs to XML. Converter from C# to VB.NET are sufficiently available on the internet.