I know the question was specifically for VBA, and is a little dated, but since I found this question in a search for a solution to my similar situation, using c#.net, I will post the solution I found.
Firstly, to open any extension not already provided by Catalog, you must define your own custom GX filter class. Below, I create a filter for XML extensions.
public class GxCustomFilter : ESRI.ArcGIS.Catalog.IGxObjectFilter {
private IGxObjectFilter _basicFilter;
public GxCustomFilter(){
_basicFilter = new GxFilterBasicTypesClass();
}
public bool CanChooseObject(ESRI.ArcGIS.Catalog.IGxObject obj, ref ESRI.ArcGIS.Catalog.esriDoubleClickResult result) {
//Set whether the selected object can be chosen
bool bCanChoose = false;
bCanChoose = false;
if (obj is IGxFile) {
string sExt = null;
sExt = GetExtension(obj.Name);
if (sExt.ToLower() == ".xml") // define your extension here
bCanChoose = true;
}
return bCanChoose;
}
public bool CanDisplayObject(ESRI.ArcGIS.Catalog.IGxObject obj) {
//Check if objects can be displayed
try {
//Check objects can be displayed
if (_basicFilter.CanDisplayObject(obj))
return true;
else if (obj is IGxFile) {
string sExt = null;
sExt = GetExtension(obj.Name);
if (sExt.ToLower() == ".xml") // define your extension here
return true;
}
} catch (Exception ex) {
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
return false;
}
public bool CanSaveObject(ESRI.ArcGIS.Catalog.IGxObject Location, string newObjectName, ref bool objectAlreadyExists) {
return false;
}
public string Description {
get {
//Set filet description
return "eXtensible Markup Language (.xml)";
}
}
public string Name {
get {
//Set filter name
return "XML filter";
}
}
private string GetExtension(string sFileName) {
string tempGetExtension = null;
//Get extension
long pExtPos = 0;
pExtPos = (sFileName.LastIndexOf(".") + 1);
if (pExtPos > 0)
tempGetExtension = sFileName.Substring((Int32)pExtPos - 1);
else
tempGetExtension = "";
return tempGetExtension;
}
}
Then, in your GxDialog, you use the custom class to define a ObjectFilter. You also have to define file filters on the GxDialog.InternalCatalog.
IGxDialog gxDialog = new GxDialog();
IGxCatalog gxCat = gxDialog.InternalCatalog;
IGxFileFilter fileFilter = gxCat.FileFilter;
if (fileFilter.FindFileType("XML") < 0) {
fileFilter.AddFileType("XML", "eXtensible Markup Language ", "");
}
IGxObjectFilter objFilter = new GxCustomFilter();
gxDialog.ObjectFilter = objFilter;
If you wish to use the filter with a GxDialog.DoModalSave(), you must modify the custom filter class property CanSaveObject to return true.
I hope this helps someone, as I spent longer than I would have liked figuring it out.