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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a url to a VBScript

Status
Not open for further replies.

staleb

Programmer
Feb 7, 2005
45
NO
I am trying to pass an Url to a vb-script so that i can open a document:

In HTML I pass the value like this:

<a href="vbscript:" onclick="openDoc('<%# Me.P_WordIcon.AlternateText%>');return false;"> <width="16"><GEN:IMAGE NAME="WordIcon"></GEN:IMAGE> </a>

Passing it to this script:

<script language = vbscript>
<!--
dim objword

sub OpenDoc(strLocation)
set objWord = CreateObject("Word.Application")
objWord.Visible = true
objWord.Documents.Open strLocation
end sub
-->
</script>


This doesnt work, but if I type i the URL directly. It works fine.

Does anyone have a clue
I'm I passing the value incorectly??
 
On the HTML page with the link, can you do a "View Source" that will allow you to see the contents of your <a> tag?

So that you can see the actual result this ASP: <%# Me.P_WordIcon.AlternateText%>

... perhaps it is not doing what you think it is doing. Should that be an eqaual sign '=' instead of a pound sign '#' ???

 
That helped be a little bit.

Now the error message is:

Cant find the document.

It seems that the transaction from the
<%= Me.P_WordIcon.AlternateText%>
to the script
changes the URL from:
\\mywebarea\c\test.doc
to:
\mywebareactest.doc

I have to check to see if I can incapsolate the string value somehow



 
You may try this:
<%= Replace(Me.P_WordIcon.AlternateText, "\", "\\")%>

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top