CustomizationContext vs. Normal.dot
I just experienced another warning that Normal.dot was updated, and did I want to save it? That tells me that the CustomizationContext is needed. I’ve implemented a custom Word Template called “W2MWPPTemplate.dot” and the minimal code that I believe should cover this requirement. [This code was copied from a previous VSTO project of mine.]
Next code library: modW2MWP_FileDialog.bas
- Function TestIt() calls the custom function ahtCommonFileOpenSave(), and according to the code comments TestIt() is there just as an example
- Function ahtCommonFileOpenSave() calls either aht_apiGetOpenFileName() or aht_apiGetSaveFileName(), which both appear to just be performing string functions — nothing interesting there
- Function GetOpenFile() calls ahtCommonFileOpenSave() as well
- The functions ahtAddFilterItem(), TrimNull() and TrimTrailingNull() are all just minor string manipulations
The most interesting thing about this file’s code is that it defines a few FileOpen filters, for Access, dBASE, Text and All (*.*). I don’t know why this application would open or save from these specific file types, which leads me to wonder if this code is even in use. It’s possible it was left behind from some experiments. In any case, I’ll keep an eye out for something calling this code, but I’ll likely just use native System.IO methods once I find the caller.
Next up: frmW2MWP_Config.frm
If I remember correctly, the typical way to add a dialog box to a VSTO add-in is using a Windows Form. I added a Windows Form to the project and named it W2MWPP UI Config.vb. However, trying to infer what controls were on the VBA version of this form isn’t as easy as I thought it’d be from the code. However, I’ll see what I can do.
First up I added the New() function to the form’s code-behind using the drop-downs along the top of the editing panel in VS2005. In the New() method I’m adding functionality currently contained in UserForm_Initialize(). From what I’m seeing in this function, and what I’ve seen in the “old” documentation page, there are:
- a Registry setting for the Editor path/ImageExtractionPE (which appears to be unused now since the MS Photo Editor is no longer supported)
- a Registry setting and combo box (cboLanguage) for a Language setting (stored in a languageArr() variable)
- a Registry setting and textbox (txtURLTest) for the “Wiki Address Root” used for testing
- a Registry setting and textbox (txtURLProd) for the “Wiki Address Root” used for ‘production’
- a Registry setting and textbox (txtImagePath) for the filesystem folder path used to store extracted images
- a Registry setting and textbox (txtTabtoFileName) — though a NumericUpDown control would be better — to count the number of Tab characters needed to edit the Filename when automatically uploading image files
- There also is a “Simulate upload” function documented here
I’ll add the necessary controls to the Config form for (2) through (7). However, since the Word2WikiPlus VBA project doesn’t support the MS Photo Editor any longer, I’ll skip (1). As well, I’ll try using tooltips & status bar messages to provide help on what to do with each configuration control.