If the user answers no to your prompt, then
qfFile = "CSQuoteForm.xls"
and from the context of your code, I would assume there is no open file with
that name. thus the subscript out of range error.
--
Regards,
Tom Ogilvy
<michele@quality-computing.com> wrote in message
news:1116946140.275355.15170@g47g2000cwa.googlegroups.com...
> Hi,
>
> I'm not sure why I'm getting an error 'run-time error '9': script out
> of range' at Windows(qfFile).Activate
>
> Here is the code:
>
> Sub ProcessCS()
>
> Const qfPath = "C:\Documents and Settings\John\My
> Documents\quoteprogramfiles\"
> Const qrPath = "C:\Documents and Settings\John\My
> Documents\CSQuotes\"
> Const qrFile = "CSQuoteReport.xls"
>
> ' Check if you are in the quote or a processed quote
> If isFile(qfPath & "CSQuoteForm.xls") = False Then
> response = MsgBox("This quote has already been processed. Do
> you want to create a new quote with a new quote number by copying this
> already processed quote?", _
> vbYesNo + vbQuestion)
> qfFile = ThisWorkbook.Name
> Else
> response = vbNo
> qfFile = "CSQuoteForm.xls"
> End If
>
> Windows(qfFile).Activate
> Range("F3").Select
> ActiveCell = q
>
> I'm just a novice at this and would much appreciate the help. I'm
> reading a VB book, but need to know quickly for a job I'm doing. Sorry
> to be a pest.
>
> Also, the file personal.xls keeps randomly opening and if anyone has a
> hint where I can look to stop this, that would be great, too. I can't
> even find the file.
>
> Michele
>
Bookmarks