I find working with quotes sometimes confusing, but you could use this instead:
Shell "Start """ & myFilename & """"
instead of
Shell "Start " & chr(34) & myfilename & chr(34)
Lyndon Rickards wrote:
>
> Thanks as always Dave. And I never would have guessed
> chr(<anything>)...haven't used that since my early Basic
> days - early 80's.
>
> Geez how I wish Excel supported PerlScript!
>
> Best - Lynn.
>
> Dave Peterson wrote:
> > Option Explicit
> > Private Sub CommandButton1_Click()
> > dim teststr as string
> > dim myFileName as string
> >
> > myfilename = "x:\pathtoyourfile\yourfile.ext")
> >
> > teststr = ""
> > on error resume next
> > teststr = myfilename
> > on error goto 0
> > if teststr = "" then
> > msgbox "file not found
> > exit sub
> > end if
> >
> > 'take a look at Shell to see how to start other programs
> > 'maybe something like:
> > Shell "Start " & chr(34) & myfilename & chr(34)
> >
> > End Sub
> >
> > Lyndon Rickards wrote:
> >
> >>This must be too easy, if only it wasn't for
> >>the vicodin...so please be patient with me ;->
> >>
> >>Private Sub CommandButton1_Click()
> >>system("pdfFile.pdf")
> >>' or "docfile.doc"
> >>' or "file.html"
> >>End Sub
> >>
> >>The external files will be distributed with the workbook, so I'm
> >>not concerned about path relativity, though it would be nice to
> >>be able to throw a msgbox just in case the file is not present in
> >>the same folder as the workbook, or in the unlikely event
> >>a suitable application is not available.
> >>
> >>TIA - Lynn.
> >
> >
--
Dave Peterson
|