tags:

views:

366

answers:

3

I'm going to have to write a number of vba modules for a project I'm working on, and would prefer to use SciTe to the built in editer in Office.

SciTe allows you to redirect the effect of hitting F1 to a arbitary command with the selected text as an argument. Is there anyway of using this functionality to search the relevant .chm files?

I'm guessing not, given that the help for vba is spread across multiple files, but I'm hoping someone can prove me wrong...

I'm especially interested if anyone can suggest a way to find out which chm file a particular libraries help resides, just from the fully delimitered name of the function.

+1  A: 

The main files are held (for Office 2003 anyway) in Program Files\OFFICE11\1033, but accessing pages within them could be a bit tricky as Microsoft have gradually had to reign in the ability to delve into CHM files over the years due to security concerns. This page (download) has some good info on what might still be possible as far as linking to specific pages inside a CHM

Having said that, I don't think this file is the default help shown to most users nowadays, but it's close enough, missing only the Office 2007 pimping most of the time. The online help seems to be set as default unless you specifically disable it during the Office install. The URLs are, I think, not very SEO friendly so couldn't be guessed. I suppose you could borrow a sneaky trick from scammers and craft URLs that point to the top link on Google, thusly: Range.

EDIT: Google cache link?

Lunatik
I'm not sure that the first link goes where you meant it to go :). The Google trick is a nice work around I hadn't thought of, especially limited using site:.
mavnn
Oops. Fixed now.
Lunatik
Site blocked from work for containing potentially damaging Freeware... La sigh. Gotta love the corporate firewall.
mavnn
I've uploaded it as a complete MHT file (35KB) here: http://www.2shared.com/file/5882936/c265dcde/Linking_to_a_CHM_Window.html
Lunatik
"This Websense category is filtered: Personal Network Storage and Backup" Many thanks for the try, I think we can give up at this point...
mavnn
Ouch. You've got it far worse than we do here.
Lunatik
I refuse to be beaten by The Man and his firewall. What about Google's cached version?
Lunatik
It's cleverer than that: it checks where the link came from and gives the same blocking screen. I'm thinking I'm probably reaching the limits of what I can try and still reasonably justify to IT if they come a'knocking. TBH, in most ways The Man is a pretty good employer. IT policy wise? Not so much...
mavnn
+1  A: 

Inspired heavily by Lunatik's answer, adding:

command.help.$(file.patterns.vb)=http://www.google.co.uk/search?hl=en&newwindow=1&q=site%3Amsdn.microsoft.com+%222003+VBA%22+$(CurrentWord)
command.help.subsystem.$(file.patterns.vb)=2

to my vb.properties file gives me a reasonable work around (loads a Google search results page with search criteria of:

site:msdn.microsoft.com "2003 VBA" $(CurrentWord)

Obviously no guarantees of it taking me to a helpful page, but then the inline help in the VBA editer isn't all that reliable on that one either...

Can anyone who knows SciTe better suggest a more elegant solution?

mavnn
Lunatik
The search is crude enough that I generally have to pick a result, hence the omission of 745 :). I did try both.
mavnn
+1  A: 

Another approach is to use the HTML Help command line program HH.EXE to either show specific pages, or to decompile a particular CHM into HTML files.

Go to the folder mentioned by Lunatik in a command window and enter this command:

hh -decompile html vbaac10.chm
                      ^^
# ac is for Access; use xl for Excel, wd for Word, etc

This will create an "html" folder below it and fill it with most of the files that went into creating the CHM file. The resulting HTML files can be opened directly in your browser, although they won't find their related style sheets or scripts which are addressed by their locations in CHM files. The style sheets and scripts do get extracted though so you can work with them too.

Also take a look at the XML files in the 1033 folder like VB_ACTOC.XML - this is the Table of Contents for the Access VBA help. It contains topic nodes with labels and urls for each item in the help file:

<topic>
  <label>CheckBox Object</label>
  <url>mk:@MSITStore:vbaac10.chm::/html/acobjCheckBox.htm</url>
</topic>

The mk:etc... url can be put on the HH command line to open that topic in a regular HTML Help window. Also, it shows the source CHM filename, and the relative path of the file when decompiled.

hh mk:@MSITStore:vbaac10.chm::/html/acobjCheckBox.htm

Working from these files, you could put together a script to find/grep files by keyword and show them in a browser, or you could reengineer the files into some sort of database or other lookup capability to work with SciTe's command based help system.

Some sites with more info about using HH.EXE:

  • HTMLHelp command-line

    tips on using the HH command line and links to other sites

  • KeyHH 1.1

    an alternate/supplemental program to HH.EXE for working with CHM files

Todd
Very, very helpful. Thank you.
mavnn