View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default MS-DOS commands from within Visual Basic Version 6.3

This might be a printer issue, a separator page. It may not be readily
changed with VBA through a print setup dialog, and I doubt Shell will touch
it. See if you can set it manually.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Freddy" wrote in message
...
I implemented your suggestion successfully. However, a side issue has
resulted during printing. Although I receive my one page printout, it is
followed by a blank trailer page. How can I eliminate the trailer page?

"Jon Peltier" wrote:

Read a little bit about string manipulation. This line does what you
want,
if you don't have to worry about the path:

Shell ("print " & workfiles1)

If you need to worry about the path, then you have to get it (probably
using
CurDir) and insert it into the line above.

I'd probably use GetOpenFileName with multiple selection enabled and
using a
filter for *.rpt, then process the nice array of the selected file names
that is returned.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Freddy" wrote in message
...
Jim, this is what I am testing now:

Sub test()
Application.Dialogs(xlDialogOpen).Show
RFileType = "*.rpt"
Dim workfiles1 As String
workfiles1 = Dir(RFileType)
While workfiles1 < ""
Shell ("print workfiles1") 'THIS IS WHERE I WANT THE PRINT
VARIABLE
TO GO
workfiles1 = Dir()
If workfiles1 = "" Then
End
End If
Wend
End Sub




"Jim Thomlinson" wrote:

Something like this???

dim str as string

str = "c:\tmp\"
Shell ("print " & str & "*.rpt")

--
HTH...

Jim Thomlinson


"Freddy" wrote:

Tom, the command I used successfully as a test was: Shell ("print
c:\tmp\*.rpt")
The part I want to be a variable is the print parameter (or file
name),
which I have stored in previous lines of Visual Basic code.

"Tom Ogilvy" wrote:

show the command you used and the part you want to be variable.

The argument to shell is a string, so you can concatenate a
variable
value
into the string

--
Regards,
Tom Ogilvy


"Freddy" wrote:

I tested your response successfully. Along these lines, can I
pass
a variable
within the Shell command?

"Martin" wrote:

Don't know about VB but in VBA you can use Shell("path and
executable")

"Freddy" wrote:

How do I run an MS-DOS command, specifically "print" an
external file, from
within Visual Basic Version 6.3? Does anyone have sample
code?