LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Run Time Error 9, Script Out of Range

Hi Jeff,

Try

Windows(InvFileName & ".xls").Activate

Best Regards

Bill
-----Original Message-----
HI,

I am using the code below , but when it gets to;
Windows(InvFileName).Activate ; it debugs and says;
"Run time error 9, Script out of range.

I ran this at home and it worked OK, but at work it

crashes.
At home i have a laptop with MS Millenium on it.
At work I have Windows 98.
Does this have anything to do with it ??

Note that InvFileName and NewFolder are both "Public"

variables, but
declared in a different module.

Thanks in advance for any help.
Jeff



Sub SaveInvAsNewFile()

'name of new folder
NewFolder = Format(Now, "yy-mm-dd") & " Invoices"


'Call the name as the text in cell z18
InvFileName = Sheets("InvoiceForm").Cells(18, 26)

'Opens new spreadsheet
Workbooks.Add

On Error Resume Next
ActiveWorkbook.SaveAs Filename:="N:\Invoices\" &

NewFolder & "\" &
InvFileName & ".xls"
On Error GoTo 0

Windows("Generate Report and Invoices.xls").Activate

Range("A1:L59").Select
Selection.Copy

Windows(InvFileName).Activate 'THIS IS THE LINE THAT

DEBUGS.



.

 
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
cycle time out of range error Access lightweight Excel Discussion (Misc queries) 1 January 15th 08 04:58 PM
Run time error 9 : Subscript out of range JAtz_DA_WAY Excel Discussion (Misc queries) 6 August 29th 05 08:26 PM
How do you sum a range of more than 30 cells. I get error each time I try. Joseph Conaghan via OfficeKB.com Excel Worksheet Functions 5 March 21st 05 10:15 PM
Run time error '9' Subscript out of range Tina Excel Programming 1 August 25th 03 02:05 AM
Run time error 9 (subscript out of range) Nathaniel Tigere Excel Programming 2 August 5th 03 11:12 AM


All times are GMT +1. The time now is 11:41 PM.

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

About Us

"It's about Microsoft Excel"