Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Creating VB script on classic ASP webpage

$
0
0

I'm trying to use the below VB script (XlsToCsv.vbs) on a classic ASP webpage. After running the script a blank page is displayed and the file PRD_new.csv is not created. The vbs file works in MS-DOS.

<script language="vbscript">
	csv_format = 6

	Set objFSO = CreateObject("Scripting.FileSystemObject")

	src_file = objFSO.GetAbsolutePathName("D:\My Websites\www.fk-sales.com\PRD_new.xls")
	dest_file = objFSO.GetAbsolutePathName("D:\My Websites\www.fk-sales.com\PRD_new.csv")

	Dim oExcel
	Set oExcel = CreateObject("Excel.Application")

	Dim oBook
	Set oBook = oExcel.Workbooks.Open(src_file)

	oExcel.DisplayAlerts = False

	oBook.SaveAs dest_file, csv_format

	oExcel.DisplayAlerts = True

	oBook.Close False
	oExcel.Quit
</script>

I've also tried creating a vbs file and running the below code although the error appears saying "ActiveX component can-t create object: -Excel.Application-"

<%
Dim objShell
Dim vbsFile

vbsFile = "D:\My Websites\www.fk-sales.com\XlsToCsv.vbs"
Set objShell = Server.CreateObject("Wscript.Shell")

objShell.Run vbsFile

Set objShell = Nothing
%>


Viewing all articles
Browse latest Browse all 488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>