Looch wrote:
> On Jun 4, 4:18 pm, Alexey Smirnov <alexey.smir...@gmail.com> wrote:
>> On Jun 4, 10:12 pm, Looch <lucianoj2...@yahoo.com> wrote:
>>
>>> Something simple here (hopefully)...how can I append the text in a
>>> text box to a hyperlink? For example, I enter the string 'Printer223'.
>>> There is an Excel file with the same name that I want to open
>>> (Printer223.xls). Basicallyhttp://localhost/printers/whateverIput
>>> in the textbox.xls is what I'm after. Thanks.
>> How do you want to open the file? Using a postback button?
>>
>> Response.Redirect("http://localhost/printers/" + TextBox1.Text +
>> ".xls");
>
> Basically I just need to do this (using VBScript). The example below
> doesn't seem to work though.
>
> "http://amslpsvr1/consumables/OrderForms/" & strOrder &".xls"
>
> Here's the actual code (I'm a noob but I can get any Excel file to
> open this way!)
>
> <script language ='vbscript' >
> dim objExcel
> dim wb
> dim strOrder as string = me.txtOrderFrm.text
> Sub cmdOrderFrm_onclick()
> call OpenWorkbook("http://amslpsvr1/consumables/OrderForms/" &
> strOrder & ".xls")
> end sub
> sub OpenWorkbook(strLocation)
> set objExcel = CreateObject("Excel.Application")
> objExcel.Visible = true
> objExcel.Workbooks.Open (strLocation)
> objExcel.UserControl = true
> end sub
> </script>
>
> Thanks again for any help.
>
First of all, you are in the wrong newsgroup. This has nothing to do
with ASP.NET.
Anyway, depending on where you put the script, you are either getting
the value from the text box when the page is loading, or trying to get
it before the text box even exists.
If you want to get the value from the text box at the time of calling
the cmdOrderForm_onclick subroutine, you have to put the code that gets
the value inside the subroutine.
Note also that "me" gets a different meaning if you put it inside the
subroutine, as it then will refer to the control that you clicked rather
than the window object.
--
Göran Andersson
_____
http://www.guffa.com