×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Issue with this not calling the Sub in Classic ASP page

Issue with this not calling the Sub in Classic ASP page

Issue with this not calling the Sub in Classic ASP page

(OP)


CODE --> VBscript

<a href="#" onclick="PrintPdf()" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Generate Report</a> 

Okay Guys If I run this I am getting zilch, nada, nothing, null!

I have tried using onclick=PrintPdf() - onclick="PrintPdf();" - onclick="call PrintPdf()" All to no avail. I am trying to run a batch file. If I change this to Javascript and click teh button it calls
a Javascript but I need the Vbscript.



CODE --> Vbscript

<script language="vbscript"> 
        Sub PrintPdf()
        Dim oShell,strPath
        Set oShell = CreateObject ("WScript.Shell")
        strPath1=Server.MapPath("PDFSaveTest.bat")
        oShell.Run strPath1 
        set OShell= (Nothing)
        End Sub
 </script> 

RE: Issue with this not calling the Sub in Classic ASP page

Are you running in IE - VBScript only works in IE: it will not work in Chrome, Firefox, Opera or any other browser.

RE: Issue with this not calling the Sub in Classic ASP page

I thought VBScript in ASP pages ran on the server so the browser doesn't make any difference.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Issue with this not calling the Sub in Classic ASP page

It depends on whether the vbscript is in the served page or is actually on the server. From the script posted, it looks like it is the served page. This wouldn't make a lot of sense on a server. Also you can't click a button on a server.

The other thing about it is that the batch file would have to be on the client. Maybe the script does work but it needs the batch file on the client.

Try adding a message box to print out what strPath1 is.

RE: Issue with this not calling the Sub in Classic ASP page

Quote:


I thought VBScript in ASP pages ran on the server so the browser doesn't make any difference.

Server-side script would be encapsulated with <% %>


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close