Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default MS-DOS commands from within Visual Basic Version 6.3

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?



  #2   Report Post  
Posted to microsoft.public.excel.programming
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?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dealing with different version of Excel using Visual Basic 6 khundeen Excel Programming 3 June 27th 06 09:18 AM
visual basic Mid() does not work with swedish version of excel LindhJonas Excel Programming 8 February 7th 06 07:08 PM
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM
Visual Basic commands for email David Overington Excel Programming 1 February 9th 05 02:39 AM
Excel version identification from Visual Basic Raja Ranga Excel Discussion (Misc queries) 6 January 17th 05 08:48 PM


All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"