Thanks for the feedback. Think I know most of that though I'll look again at
the path update (I thought it did but could be wrong) and didn't know about
spaces in the help file name being a problem (I've never had a help file
with spaces in it). Seems odd thought that it's only the file name that
cause a problem but not the path. Did you try apostrophes.
Anyway, I'll keep a note of your comments. Glad you got it all sorted out.
Regards,
Peter T
I got there. The systematic approach worked in the end - Thanks!
I think with all my playing around I must have slightly corrupted the
workbook as I couldn't even get the simple MacroOptions help to
display. I copied my code modules to a new workbook via notepad and
then was able to get the basic version working. After that no problem
with Laurent's custom categories approach either. Along the way I did
learn a couple of things which I'll summarise here in case anyone
picks up this post in the future:
The built-in Excel method:
1) You must specify the full path (Project properties dialog) not just
the file name. Excel doesn't look for your help file in the same
folder as the workbook
2) The path to the help file that you specify will not automatically
update if you relocate the workbook and help file to another folder.
In most cases you can't guarantee where a user might store the add-in
so you're probably best to set the path via code at run time,
Application.MacroOptions
3) I couldn't get the HelpID to persist after entering it via the
ObjectBrowser (kept resetting to 0). Setting via
Application.MacroOptions worked
The "Longre method":
1) The help file and topic ID provided via the VB Editor is completely
separate from that provided via Laurent's dll. Help set via the VB
Editor will only show up when your function is accessed via the
UserDefined category (not the category defined by the Longre method).
To illustrate this you can specify different help files for the same
function via the two different approaches. The reason for this is
that they aren't really the same function until they get inserted into
the workbook.
2) You must include the full path in the HelpID field not just the ID
number (ie. as per Peter's post path/filename.chm!100). This follows
from point 1.
3) You can't have any spaces in the name of the help file. Spaces in
the path are okay but not in the name. I tried quotes (both double
and single around the HelpID field) but neither worked
And I guess finally, because I just began to wonder why all this was
so important - it's because the Longre method lets you specify
descriptions for each of your functions parameters. All the rest
(custom categories, link to help file) can be done just using
Application.MacroOptions. Custom descriptions can be provided in
xl2010 but most users don't have that yet.
Hope this is of help to someone one day.
Thanks again Peter.
Cheers,
Andrew
I recall getting to grips with chm being a very frustrating experience!
I completely forgot to say to do this (if you haven't already) -
In Object browser (F2), select your project in the list of libraries
In Classes select the module with the UDFs
Right click on a UDF, Properties
In Help Context ID enter your ID, eg 102
With the 'Help file name' in project properties test if you get the help
before registering the DLL
If that works now register the DLL and try from the Custom category, does
it
work?
If not include the full path as before in the HelpID field.
If it didn't even work unregistered maybe there's something wrong with the
chm. Try calling the id using the Help API (more learning !)
Regards,
Peter T
Here's what I've tried and where I'm at:
I have set the path the chm file in project properties. However, I
only expect that to affect the help provided by the function sitting
under the "User defined functions" category. If I understand/
remember correctly the function displayed in my custom category is
actually a function from the dll - it's only when it gets inserted
into the workbook that it uses the VBA function. So I think the help
file needs to be set by the dll (ie. defined in Laurent's sheet) not
just in the VBA project.
Anyway, I tried setting the help ID via Application.MacroOptions just
incase that worked. Even when accesesing via the "User defined
functions" category I get an error message, "Error opening MSHelp".
Not sure if that's due to a conflict with the dll help link.
If I enter the Help ID in Laurent's sheet as "c:\...
\ConverUnitsHelp.chm!102" then the help app tries to open but just
shows a blank page. Curiously, if I don't have the quotes around the
entry (which I assume was what was intended) then everything hangs and
eventually I get the message, "Not enought memory...". If I include
the quotes then it doesn't hang but I still just get a blank help
page.
If I just enter teh ID in Laurent's sheet, ie. 102 then I get a
message: "Help reference not valid" and then "No help available". I
suspect this is probably coming from the .dll itself.
It almost looks like there something wrong with my ID and file mapping
but I think I'm using the same mapping as you - except with different
file names (I just used the names in the book), ie.
[ALIAS]
#include TopicToID.h
[MAP]
#include TopicToFile.h
where TopicToID.h contains:
ConvertUnit=ConvertUnit.htm
and TopicToFile.h contains:
#define ConvertUnit 102
Not sure if I'm missing something or you have any other suggestions to
try?
Thanks again,
Andrew- Hide quoted text -
- Show quoted text -