File system object - print tif file

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi,

This is a repost. Does anyone have a clue how I might solve this? I'm
including my code at the end. THANKS!!!!!!!

To briefly explain, the file name of a *.tif file (the image of the form
that created the record) is located within a table.

I've written code using the file system object method, which can locate,
copy, move, delete, etc. the target file.

What I could really use at this point is help in printing out that file.
File system object does not seem to be able to do it; [path].print doesn't
work either.

If you've successfully opened a TXT, DOC, JPG, etc. file using a module, you
may be able to help me; how did you accomplish it?

Simplified code (needs

For Each objsubfolder In objFolder.SubFolders 'Scans all folders for
FileName
ST = rst!ImageSyntax2
path = objsubfolder.path
ST = path & "\" & ST
If fso.FileExists(ST) Then
fso.CopyFile ST, "J:\Teleform\SCANDIR\"
msgkey = 1 'File has been found
End If

I'd like to change

fso.CopyFile ST, "J:\Teleform\SCANDIR\"

to

fso.PrintFile ST

or

ST.print

but that of course does not work.

Thanks!
 
I don't know if this will help, but on my work machine I
have MS Access 2000 and QuickViewPlus (among other
things). I wrote a .tif viewing procedure to work with a
table that has the path/file name of the .tifs. The
procedure calls QVP's command-line options using the
shell function, something like the following (QVP command
line syntax is not exact):


Dim varShell as Variant
Dim strFileName as String

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

QVP has a command line print parameter, tho I haven't
used it. Perhaps you can do something similar with
whatever file viewer you have. Anyway, hope this helps!

-John McE
 
Just a quick comment.

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

should be

varShell = Shell("C:\[path]\qvp.exe " & Chr$(34) & strFilename & Chr$(34))

in order to be able to handle file names with embedded spaces.

If qvp.exe is in a folder that has embedded spaces, you'd also need Chr$(34)
(which is ") around it.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



I don't know if this will help, but on my work machine I
have MS Access 2000 and QuickViewPlus (among other
things). I wrote a .tif viewing procedure to work with a
table that has the path/file name of the .tifs. The
procedure calls QVP's command-line options using the
shell function, something like the following (QVP command
line syntax is not exact):


Dim varShell as Variant
Dim strFileName as String

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

QVP has a command line print parameter, tho I haven't
used it. Perhaps you can do something similar with
whatever file viewer you have. Anyway, hope this helps!

-John McE

-----Original Message-----
Hi,

This is a repost. Does anyone have a clue how I might solve this? I'm
including my code at the end. THANKS!!!!!!!

To briefly explain, the file name of a *.tif file (the image of the form
that created the record) is located within a table.

I've written code using the file system object method, which can locate,
copy, move, delete, etc. the target file.

What I could really use at this point is help in printing out that file.
File system object does not seem to be able to do it; [path].print doesn't
work either.

If you've successfully opened a TXT, DOC, JPG, etc. file using a module, you
may be able to help me; how did you accomplish it?

Simplified code (needs

For Each objsubfolder In objFolder.SubFolders 'Scans all folders for
FileName
ST = rst!ImageSyntax2
path = objsubfolder.path
ST = path & "\" & ST
If fso.FileExists(ST) Then
fso.CopyFile ST, "J:\Teleform\SCANDIR\"
msgkey = 1 'File has been found
End If

I'd like to change

fso.CopyFile ST, "J:\Teleform\SCANDIR\"

to

fso.PrintFile ST

or

ST.print

but that of course does not work.

Thanks!



.
 
Hi there
[...]
varShell = Shell("C:\[path]\qvp.exe " & Chr$(34) & strFilename & Chr$(34))

Instead of Chr$(34), you can also use pairs of quotes inside the string
which results in slightly less code. Therefore, e.g. ["Hello " & Chr$(34) &
"World" & Chr$(34)] is the same as ["Hello ""World"""] and results in the
text [Hello "World"]. Applying this VB-feature, your code can be
shortened to:

varShell = Shell("C:\[path]\qvp.exe """ & strFilename & """")

Note that there are 3 "-characters after .exe and even 4 of them
at the end...


Cheers,
Martin


Douglas J. Steele said:
Just a quick comment.

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

should be

varShell = Shell("C:\[path]\qvp.exe " & Chr$(34) & strFilename & Chr$(34))

in order to be able to handle file names with embedded spaces.

If qvp.exe is in a folder that has embedded spaces, you'd also need Chr$(34)
(which is ") around it.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



I don't know if this will help, but on my work machine I
have MS Access 2000 and QuickViewPlus (among other
things). I wrote a .tif viewing procedure to work with a
table that has the path/file name of the .tifs. The
procedure calls QVP's command-line options using the
shell function, something like the following (QVP command
line syntax is not exact):


Dim varShell as Variant
Dim strFileName as String

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

QVP has a command line print parameter, tho I haven't
used it. Perhaps you can do something similar with
whatever file viewer you have. Anyway, hope this helps!

-John McE

-----Original Message-----
Hi,

This is a repost. Does anyone have a clue how I might solve this? I'm
including my code at the end. THANKS!!!!!!!

To briefly explain, the file name of a *.tif file (the image of the form
that created the record) is located within a table.

I've written code using the file system object method, which can locate,
copy, move, delete, etc. the target file.

What I could really use at this point is help in printing out that file.
File system object does not seem to be able to do it; [path].print doesn't
work either.

If you've successfully opened a TXT, DOC, JPG, etc. file using a module, you
may be able to help me; how did you accomplish it?

Simplified code (needs

For Each objsubfolder In objFolder.SubFolders 'Scans all folders for
FileName
ST = rst!ImageSyntax2
path = objsubfolder.path
ST = path & "\" & ST
If fso.FileExists(ST) Then
fso.CopyFile ST, "J:\Teleform\SCANDIR\"
msgkey = 1 'File has been found
End If

I'd like to change

fso.CopyFile ST, "J:\Teleform\SCANDIR\"

to

fso.PrintFile ST

or

ST.print

but that of course does not work.

Thanks!



.
 
Sure. I find that Chr$(34) is easier to see what's happening, but either way
works.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Martin Seelhofer said:
Hi there
[...]
varShell = Shell("C:\[path]\qvp.exe " & Chr$(34) & strFilename &
Chr$(34))

Instead of Chr$(34), you can also use pairs of quotes inside the string
which results in slightly less code. Therefore, e.g. ["Hello " & Chr$(34) &
"World" & Chr$(34)] is the same as ["Hello ""World"""] and results in the
text [Hello "World"]. Applying this VB-feature, your code can be
shortened to:

varShell = Shell("C:\[path]\qvp.exe """ & strFilename & """")

Note that there are 3 "-characters after .exe and even 4 of them
at the end...


Cheers,
Martin


Douglas J. Steele said:
Just a quick comment.

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

should be

varShell = Shell("C:\[path]\qvp.exe " & Chr$(34) & strFilename & Chr$(34))

in order to be able to handle file names with embedded spaces.

If qvp.exe is in a folder that has embedded spaces, you'd also need Chr$(34)
(which is ") around it.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



I don't know if this will help, but on my work machine I
have MS Access 2000 and QuickViewPlus (among other
things). I wrote a .tif viewing procedure to work with a
table that has the path/file name of the .tifs. The
procedure calls QVP's command-line options using the
shell function, something like the following (QVP command
line syntax is not exact):


Dim varShell as Variant
Dim strFileName as String

varShell = Shell("C:\[path]\qvp.exe " & strFilename)

QVP has a command line print parameter, tho I haven't
used it. Perhaps you can do something similar with
whatever file viewer you have. Anyway, hope this helps!

-John McE


-----Original Message-----
Hi,

This is a repost. Does anyone have a clue how I might
solve this? I'm
including my code at the end. THANKS!!!!!!!

To briefly explain, the file name of a *.tif file (the
image of the form
that created the record) is located within a table.

I've written code using the file system object method,
which can locate,
copy, move, delete, etc. the target file.

What I could really use at this point is help in
printing out that file.
File system object does not seem to be able to do it;
[path].print doesn't
work either.

If you've successfully opened a TXT, DOC, JPG, etc. file
using a module, you
may be able to help me; how did you accomplish it?

Simplified code (needs

For Each objsubfolder In objFolder.SubFolders 'Scans
all folders for
FileName
ST = rst!ImageSyntax2
path = objsubfolder.path
ST = path & "\" & ST
If fso.FileExists(ST) Then
fso.CopyFile
ST, "J:\Teleform\SCANDIR\"
msgkey = 1 'File has been found
End If

I'd like to change

fso.CopyFile ST, "J:\Teleform\SCANDIR\"

to

fso.PrintFile ST

or

ST.print

but that of course does not work.

Thanks!



.
 
Back
Top