(view source code of qpro2xls.vbs as plain text)
Option Explicit
Dim objFSO, objQPro
Dim strExcel, strQPro
With WScript.Arguments
If .Named.Exists("?") Then Syntax ""
If .Named.Count > 0 Then Syntax "Syntax error: invalid switches"
If .Unnamed.Count <> 1 Then Syntax "Syntax error: invalid number of arguments"
strQPro = .Unnamed(0)
End With
strExcel = Replace( strQPro, ".qpw", ".xls" )
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
With objFSO
If Not .FileExists( strQPro ) Then Syntax "Error: file not found"
If .FileExists( strExcel ) Then .DeleteFile strExcel, True
End With
Set objFSO = Nothing
Set objQPro = CreateObject( "QuattroPro.PerfectScript" )
If Err Then Syntax "Error: cannot open Quattro Pro"
With objQPro
On Error Resume Next
.FileOpen strQpro
If Err Then
Syntax "Error: cannot open file"
Else
.FileSaveAsExcel strExcel
.FileClose
If Err Then Syntax "Error: cannot save file"
End If
.Quit
On Error Goto 0
End With
Set objQPro = Nothing
Sub Syntax( myMsg )
Dim strMsg
If IsObject( objQPro ) Then objQPro.Quit
Set objFSO = Nothing
Set objQPro = Nothing
If myMsg <> "" Then strMsg = vbCrLf & myMsg & vbCrLf
strMsg = strMsg & vbCrLf _
& "QPro2Xls.vbs, Version 1.00" _
& vbCrLf _
& "Convert a Quattro Pro spreadsheet to Excel" _
& vbCrLf & vbCrLf _
& "Usage: [ CSCRIPT ] QPRO2XLS.VBS qpro_file" _
& vbCrLf & vbCrLf _
& "Where: ""qpro_file"" is the file name of the Quattro" _
& vbCrLf _
& " Pro spreadsheet to be converted" _
& vbCrLf & vbCrLf _
& "Notes: Quattro Pro must be installed to use this script." _
& vbCrLf _
& " The Excel ""target"" file will have the same name" _
& vbCrLf _
& " and will be located in the same directory as the" _
& vbCrLf _
& " Quattro Pro ""source"" file." _
& vbCrLf _
& " If the Excel ""target"" file exists, it will be" _
& vbCrLf _
& " overwritten without confirmation." _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" _
& vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit 1
End Sub
page last modified: 2024-04-16; loaded in 0.0099 seconds