how to find a spool file by VBA???????????

V

Vit

Hi to everybody ;o)

I'm new on this group...

I try to get information (access and vba) of the spool process of the
fax printer (I'm using zetafax server/cliant).

this is the point:

I have to wait untill the spool process il finished.. and after this I
can pass to the zetafax client the adress (fax number en subject...)

I have written the following code, but there is something wrong....

Public Function Wait()

Dim pauseDuration As Single
Dim fileSize As Long
Dim strSpoolFile As String
Dim tmStart As Double

strSpoolFile = Read_registry_Value("HKEY_LOCAL_MACHINE\SYSTEM
\CurrentControlSet\Control\Print\Printers\Zetafax Printer\Port")

Do
DoEvents
fileSize = FileLen(strSpoolFile)
Loop While fileSize = 0

pauseDuration = 2
tmStart = Timer

Do While Timer < tmStart + pauseDuration

DoEvents
Loop

Exit Function

oops:

If Err.Number = 53 Then

Resume Next

End If

MsgBox Err.Description

End Function


Public Function Read_registry_Value(ByVal KeyName As String) As String

On Error GoTo 0

Dim Shell As Object
Dim keyvalue As String


Set Shell = CreateObject("wscript.shell")
On Error Resume Next
keyvalue = Shell.regread(KeyName)
If Err.Number <> 0 Then
MsgBox "Invalid Registry Entry"
End If



Read_registry_Value = keyvalue


End Function


the debug system telll me that there is somenting wrong on the

fileSize = FileLen(strSpoolFile)

it tell me the strSpoolFile is not a valid data.... why????

how can I find the correct spool file?????

thank you very much!!!!

Vt
 
K

Karl E. Peterson

Vit said:
Hi to everybody ;o)

I'm new on this group...

I try to get information (access and vba) of the spool process of the
fax printer (I'm using zetafax server/cliant).

this is the point:

I have to wait untill the spool process il finished.. and after this I
can pass to the zetafax client the adress (fax number en subject...)

I have written the following code, but there is something wrong....
strSpoolFile = Read_registry_Value("HKEY_LOCAL_MACHINE\SYSTEM
\CurrentControlSet\Control\Print\Printers\Zetafax Printer\Port")

Do
DoEvents
fileSize = FileLen(strSpoolFile)
Loop While fileSize = 0
the debug system telll me that there is somenting wrong on the

fileSize = FileLen(strSpoolFile)

it tell me the strSpoolFile is not a valid data.... why????

Because it's the path/name of a registry key, not a file. The FileLen function
*expects* a filename, not a registry key. Your usage makes absolutely no sense.
how can I find the correct spool file?????

thank you very much!!!!

Seems a definition of terms is in order.
 
V

Vit

Because it's the path/name of a registry key, not a file. The FileLen function
*expects* a filename, not a registry key. Your usage makes absolutely no sense.



Seems a definition of terms is in order.
--
.NET: It's About Trust!
http://vfred.mvps.org- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

ok I understand ;o)

thank you vary much!!!!

Is it possible to find the spool file????? if yes, how can I do it????

thanks so much

Vit
 
K

Karl E. Peterson

Vit said:
ok I understand ;o)

thank you vary much!!!!

Is it possible to find the spool file????? if yes, how can I do it????

Jonathan pointed you to a sample of mine that allows you to monitor the print queue.
Perhaps that is what you're really trying to do? As I said, your terminology is
rather vague. "The" spoolfile, per se, is an extremely transient beast. Of what
purpose would it be to find it? Your original problem description doesn't indicate
this is a good course to be following. But then, as I said, I'm having a /really/
hard time understanding what you're asking for.
 

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

Top