Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling subs in a linked .vbs

Status
Not open for further replies.

Bixarrio

Programmer
Jul 4, 2001
59
ZA
Hi,

How do i call subs that's in a linked .vbs file.

I used:
Code:
<SCRIPT language=vbscript src='scripts.vbs'></SCRIPT>
<SCRIPT language=vbscript>
  Dim p
  p = &quot;Hello world!&quot;
  'ShowMe is a procedure in the linked script above
  ShowMe p
</SCRIPT>

I get a type mismatch 'ShowMe'

???HELP
 
I've never tried this, but just looking at it, I'd guess that you'd want to move your stuff to the following:

<SCRIPT language=vbscript src='scripts.vbs'>
Dim p
p = &quot;Hello world!&quot;
'ShowMe is a procedure in the linked script above
ShowMe p
</SCRIPT>

Of course, this is just my guess.
 
[ alistairpaul ] - No, I've tried that. It still doesn't work.

[ JohnYingling ] - Uhm. The top example was just that: an example. I used the same format as always:
This is the linked script:
Code:
Sub ShowMe(ByVal text)
  Document.Write &quot;<B>&quot; & text & &quot;</B>&quot;
End Sub

All it does is put bold tags around the parameter.

This is the call again:
Code:
<SCRIPT language=vbscript src='scripts.vbs'></SCRIPT>
<SCRIPT language=vbscript>
  Dim p
  p = &quot;Hello world!&quot;
  'ShowMe is a procedure in the linked script above
  ShowMe p
</SCRIPT>
 
Okay - Here we go -

SCRIPT FILE FOR &quot;SCRIPT REPOSITORY&quot;: /scripts.vbs

Sub ShowMe(ByVal text)
Document.Write &quot;<B>&quot; & text & &quot;</B>&quot;
End Sub

SCRIPT FILE FOR &quot;MAIN DOCUMENT&quot;: /whatever.html

<SCRIPT language=&quot;VBScript&quot; src=&quot;/scripts.vbs&quot;></SCRIPT>
<SCRIPT language=&quot;VBScript&quot;>
<!--
Dim p
p = &quot;Hello world!&quot;
document.write p
document.write &quot;<br>&quot;
ShowMe(p)
-->
</SCRIPT>

This worked 100% perfectly for me. Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top