View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tony C[_3_] Tony C[_3_] is offline
external usenet poster
 
Posts: 5
Default Setting the Help 4.0 file name and path in a locked project

Thanks for the replies guys. My original post wasn't clear: sorry. I'm
talking about "What's This" help which cannot be implemented in a VBA form
using HTML help and it has do be done with WinHelp 4.0. I am already
implementing HTML help using API calls with button clicks accessing HTML
help file URL's. It is possible to simultaneously implement WinHelp 4.0
What's This help and HTML context Help. What you do is:

For the HTML Help: Use the API calls as you described.

For the WinHelp What's this help: Either assign the *.HLP file at compile
time in the Project Properties or at run time by setting the
Application.ThisWorkbook.vbProject.HelpFile property.

This works fine and the buttons do their thing and the question mark/right
click does its thing. This is only the case, however, if the Project is
not locked for viewing; if it is locked the call to the workbook VBProject
properties generates an error at run time.

I would prefer to do it dynamically for distributing my Addins but if the
Project is protected the call to the Project properties fails. I use an
installer rather than zip format for distribution and install into a
Programme Files folder so I could assume the default file location for
What's This help and disable it if the user choses to install in a different
folder but I'd like to be a bit more elegant than that. I thought about
unprotecting the Project in code but I guess that if that can be done it's
not generally publicised. Is there another way to assign the !?

Tony


"Bob Phillips" wrote in message
...
Tony,

I was going to respond that whilst VBA may not directly support calling

help
with context ids, it can be achieved with Win APIs. That is exactly what

is
demonstrated in the post that Peter has referred you to, so take a look at
it.

HTML Help is a big improvement IMO, so stick with it. You can also see an
example add-in at

http://www.xldynamic.com/source/xld.QDEDownload.html

Peter,

No I hadn't seen that follow-up, but I have now ... thank-you!

Bob

"Peter T" <peter_t@discussions wrote in message
...
Tony,

Bob was good enough to reply to a related question of mine that you

might
want to take a look at:

subject: MyHelp.chm ????
http://tinyurl.com/6t2f6

and Bob, hope you saw my "late" thanks.

Regards,
Peter

"Tony C" wrote in message
...
Bob
Sorry, I wrote the post from memory. The line of code I am using is:

Application.ThisWorkbook.VBProject.HelpFile = ThisWorkbook.Path & "\"

&
_
gsHELPDIRECTORY & "\" & gsCONTEXTHELPFILE

This works if the project is not Protected (Locked for Viewing) but

does
not
if it is.
Activeworkbook or ThisWorkbook do not have HelpFile properties for

assigning
the
WinHelp 4.0 file name. You can assign it by right clicking the

project
in
the IDE,
selecting VBA Project Properties and assigning the help file and path

there
but
I need to assign it dynamically so that I can distribute the addin.
I am using HTML with URLs to call a number of HTML files for general

help
but as VBA does not support HTML context help I am using WinHelp 4.0
for this.


Tony


"Bob Phillips" wrote in message
...
Why are you using the vbProject? Would Activeworkbook, or

ThisWorkbook
not
do what you want?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Tony C" wrote in message
om...
To use context help (Whats this help) in an Excel VBA form I can
assign the help 4.0 file name and path using

Activedocument.vbProject.helpfile = <file name and path

However this doesn't work if the project is locked or protected as

the
vbProject properties are protected. How can I do this with a
protected project?

(Note: this was posted yesterday but the return e-mail address was

an
old one that had been canceled).

Tony C