How to call HTMLHelp with VBscript

G

Guest

Hi there,
Usually we programm under VBA - but now need to know how to call a HTML
Helpfile with VB Scripting.
The Declare function which works perfectly with VBA: (example)
"Declare Function HTMLHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" (ByVal
hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, dwDataq
As Any) As Long"
doesn't work at all with VBScript. Therefore I can't make the Call
Statement. Does anybody know how to call a Helpfile?
 
G

Guest

I want it in VBScript - as I said, in VBA it my examply given with the
declare function it works perfectly - I want to call with VBscript out of a
helpfile .chm a particular page, as example below:

ex: "How to work with script (this is the helpfile.chm) page 2 (this page I
want) - Title of Page = for advanced users"

My question is: How do I get page 2 (open it) with VBScript, clicking on the
'ok' button of a msgbox- within the vbscript?

--
Friedi


Newbie Coder said:
Friedi,

Do you want VB Script or do you want VBA?

--
Newbie Coder
(It's just a name)
 
N

Newbie Coder

Friedi,

Create a new VBS File

Paste in code below:

----------------------------------

' Written By Newbie Coder For 'Friedi'
Option Explicit

Dim objShell

Set objShell = CreateObject("WScript.Shell")

On Error Resume Next

objShell.Run "mk:mad:MSITStore:C:\MyCHM.chm::/1hh.htm", 1, False ' 1 =
SW_NORMAL | False = don't wait for exit

Set objShell = Nothing

-------------------------------------

Change the RUN line to point to your CHM file & point it to the HTM page you
want open. If you put a '#' after then the name of the anchor you will then
jump to that anchor on the page specified. Example:

objShell.Run "mk:mad:MSITStore:C:\MyCHM.chm::/1hh.htm#MyAnchor", 1, False

I hope this helps,

--
Newbie Coder
(It's just a name)




Friedi said:
I want it in VBScript - as I said, in VBA it my examply given with the
declare function it works perfectly - I want to call with VBscript out of a
helpfile .chm a particular page, as example below:

ex: "How to work with script (this is the helpfile.chm) page 2 (this page I
want) - Title of Page = for advanced users"

My question is: How do I get page 2 (open it) with VBScript, clicking on the
'ok' button of a msgbox- within the vbscript?
 
G

Guest

Hi Newbi

Thanks - it works - opening of the file is only possible in normal
(SW_NORMAL) not in SW maximise.

It's the second time you helped me out - first time was API functions with
VB 2005
a few days ago.
 
N

Newbie Coder

Friedi,

The constants for the window style can be found here:

http://msdn.microsoft.com/library/d...html/6f28899c-d653-4555-8a59-49640b0e32ea.asp

SW_SHOWMAXIMIZED = 3

Example:

objShell.Run "mk:mad:MSITStore:C:\MyCHM.chm::/1hh.htm", 3, False

or you can declare the constats like so:

Const SW_SHOWNORMAL = 1
Const SW_SHOWMAXIMIZED = 3

then use:

objShell.Run "mk:mad:MSITStore:C:\MyCHM.chm::/1hh.htm", SW_SHOWMAXIMIZED,
False

------------------------------

Although this isn't a programming newsgroup I am always here to help

Scripting newsgroups:

microsoft.public.scripting.vbscript
microsoft.public.scripting.wsh

VBA newsgroup:

microsoft.public.office.developer.vba
 
G

Guest

Yes we did it like that yesterday night - no different reaction - anyway, our
main concern was to get particular pages opened with VBscripting.

Thanks for the links - will try them out - just for your info - you gave me
a link to a VB2005 express group - its not valid anymore. --


Thanks again Newbie
Friedi (this is my real name)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top