If you want to export a collection of type Scripting.Dictionary into a text file the below function may come handy.
Source Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
' @Author - Alexander Bolte' @ChangeDate - 2014-10-07' @Description - exporting a given collection of type Scripting.Dictionary into a text file.' One line will be written per key value pair.' A key value pair will be written using the following syntax.' KEY - VALUE' @Param trgPath - a String giving the full path to the target text file including file name and extension.' @Param coll - a collection of type Scripting.Dictionary holding key value pairs to be exported into text file available under trgPath.' @Remarks - text file will be created, if not existing yet.' If text file already existing, the handed collection items will be appended at the end.PublicFunctionexportKeyCollectionToTextFile(ByValtrgPathAsString,ByRefcollAsScripting.Dictionary)DimiAsLongDimaLineAsStringDimkeysAsVariantkeys=coll.keysFori=LBound(keys)ToUBound(keys)aLine=keys(i)&" - "&coll(keys(i))CallwriteLineToTextFile(trgPath,aLine)NextiEndFunction
Referenced functions
This function uses the following functions, which have to be available in your VBA project as well.