800A0005 Inv. Procedure Call or Argument on JUST MY COMPUTER

G

George W. Jackson

I copied the code below and saved it as a .vbs file. Can anyone tell me why
I would be getting an 800A0005 error while another XP Pro. and a 2000
machine can run it just fine? The error is "An Invalid Procedure Call or
Argument" and it's on line 40, char. 1 which is this line: "set fh1 =
oFileSys.CreateTextFile(tmp)"

Thanks in advance to anyone who can help.

GJ


'FunDialogBox.vbs
'v1.2 March 2001
'Jeffery Hicks
'(e-mail address removed) http://www.quilogy.com
'Functions to display MS Common Dialog Box. You can use these functions to
provide
'more options and flexibility for opening and saving files.

'
****************************************************************************
*****
' * THIS PROGRAM IS OFFERED AS IS AND MAY BE FREELY MODIFIED OR ALTERED AS *
' * NECESSARY TO MEET YOUR NEEDS. THE AUTHOR MAKES NO GUARANTEES OR
WARRANTIES, *
' * EXPRESS, IMPLIED OR OF ANY OTHER KIND TO THIS CODE OR ANY USER
MODIFICATIONS. *
' * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED IN A
SECURED LAB *
' * ENVIRONMENT. USE AT YOUR OWN RISK. *
'
****************************************************************************
*****


'On Error Resume Next
'The first part of this script is simply demo commands of the functions
which do the real
'work in using the Common Dialog Box.

'test of Open File function
dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")

strFileOpen=OpenDlg(UCASE(wscript.Scriptname) &" - Open File","My
Filter","*.vbs")

'If StrFileOpen="" then
'wscript.echo "Nothing selected or cancelled"
'wscript.quit 'quit if nothing was selected or user cancelled
'else
'WshShell.Run ("notepad.exe " & strFileOpen)
'End If

'test of Save File function
dim oFileSys,fh1

set oFileSys=CreateObject("Scripting.FileSystemObject")
tmp=saveDlg(UCASE(wscript.Scriptname) &" - Save File","Text
File","*.txt","defaultname")

set fh1 = oFileSys.CreateTextFile(tmp)
fh1.Write "This is a test file" & VBCRLF & Now
fh1.Close

set oFileSys=Nothing
set fh1=Nothing
set WshShell=Nothing

wscript.quit


'////////////////////////////
'/ Open Common Dialog /
'////////////////////////////
Function OpenDlg(strTitle,strDesc,strExt)
'strTitle is value for Dialog Box title
'strDesc is the name of user specified filter such as VBScript Files
'strExt is a user specified extension for secondary filter in *.ext format

Dim objDlg
On Error Resume Next
set objDlg = wscript.CreateObject("MSComDlg.CommonDialog")
objDlg.Filter = "All Files (*.*)|*.*|" & strDesc & " (" & strExt & ")|" &
strExt
objDlg.DialogTitle=strTitle
objDlg.FilterIndex = 2
objDlg.MaxFileSize = 260
objDlg.CancelError = true

objDlg.ShowOpen
OpenDlg = objDlg.FileName

Set objDlg=Nothing

End Function

'////////////////////////////
'/ Save Common Dialog /
'////////////////////////////
Function SaveDlg(strTitle,strDesc,strExt,strFile)
'strTitle is value for Dialog Box title
'strDesc is name of user specified filter such as VBScript Files
'strExt is a user specified extension for secondary filter in *.ext format
'strFile is the name of the file to be saved

Dim objDlg
On Error Resume Next
set objDlg = wscript.CreateObject("MSComDlg.CommonDialog")
objDlg.Filter = "All Files (*.*)|*.*|" & strDesc & " (" & strExt & ")|" &
strExt
objDlg.DialogTitle=strTitle
objDlg.FilterIndex = 2
objDlg.MaxFileSize = 260
objDlg.CancelError = true
objDlg.Filename=strFile

objDlg.ShowSave
SaveDlg=objDlg.Filename
Set objDlg=Nothing

End Function

'EOF
 
A

Armin Zingler

George W. Jackson said:
I copied the code below and saved it as a .vbs file. Can anyone tell
me why I would be getting an 800A0005 error while another XP Pro. and
a 2000 machine can run it just fine? The error is "An Invalid
Procedure Call or Argument" and it's on line 40, char. 1 which is
this line: "set fh1 = oFileSys.CreateTextFile(tmp)"

I don't know VB script, only VB.NET. This is a VB.NET group. Please turn to
a VB script group.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top