freddy
12/18/2006 8:20:00 PM
The code I have already written runs a loop which opens a set of files
consisting of master xls workbook and several associated wk3 files which are
then used as input to the master xls workbook. In turn, the revised master
xls workbook is then printed and all open files are then closed then the loop
continues and opens another master xls spreadsheet and its associated wk3
files, etc. However, I do not want to close the application then print an
associated additional file (the extension being ".rpt") that has already been
created by another application. While my primary code is running variables
are assigned to the files being used. I'd like to take advantage of those
variables then print the associated ".rpt" file within VBA.
"Jim Thomlinson" wrote:
> What exactly is the code intended to do? I am guessing that it is supposed to
> print all of the report files in a directory specified by the user... but
> that's just a guess...
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Freddy" wrote:
>
> > 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?