LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
doj doj is offline
external usenet poster
 
Posts: 3
Default Why does this not work

I want the file containing the macro to close the "Label Supplier
Stock.xls" file on closing.

Why does it give me "error 9 - subscript out of range"???

DG

Option Explicit
Option Base 1

Const StkFile = "G:\Planning\Packaging\packaging2\Label Stocks\Label
Supplier Stock.xls"
Const StkFile_window = "Label Supplier Stock.xls"
'


Private Sub Workbook_BeforeClose(Cancel As Boolean)

Windows(StkFile_window).Close savechanges:=False

End Sub

Private Sub Workbook_Open()

Dim this_workbook_name As String

this_workbook_name = ThisWorkbook.Name
Workbooks.Open Filename:=StkFile, UpdateLinks:=False
Windows(this_workbook_name).Activate


End Sub

 
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
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM


All times are GMT +1. The time now is 09:03 AM.

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"