Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default why won't this work?

The below gives error 9: subscript out of range (when error handling is not
used). I thought it might be to do with workbooks(path), but not sure. It is
located in the ThisWorkbook object.



Private Sub workbook_open()

'sub to force intermediate xlwb to update its links without opening it

'Dim msg As String

On Error GoTo ms

with Workbooks("G:\filepath\filepath\file.xls")

..UpdateLink Name:=.LinkSources

end with

Exit Sub

ms:
msg = "links may have not updated properly" & vbNewLine
msg = msg & "open relevant file"
MsgBox msg


End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default why won't this work?

From the help file, the Workbooks property:-

Returns a Workbooks collection that represents all the open workbooks.

Try changing your line to:-

With Workbooks.Open("G:\filepath\filepath\file.xls")

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"PBcorn" wrote:

The below gives error 9: subscript out of range (when error handling is not
used). I thought it might be to do with workbooks(path), but not sure. It is
located in the ThisWorkbook object.



Private Sub workbook_open()

'sub to force intermediate xlwb to update its links without opening it

'Dim msg As String

On Error GoTo ms

with Workbooks("G:\filepath\filepath\file.xls")

.UpdateLink Name:=.LinkSources

end with

Exit Sub

ms:
msg = "links may have not updated properly" & vbNewLine
msg = msg & "open relevant file"
MsgBox msg


End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default why won't this work?

excellent - that works. If you have time - is there a way of stopping the
update links dialog box from appearing when the file is opened?

Thanks

"Alan Moseley" wrote:

From the help file, the Workbooks property:-

Returns a Workbooks collection that represents all the open workbooks.

Try changing your line to:-

With Workbooks.Open("G:\filepath\filepath\file.xls")

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"PBcorn" wrote:

The below gives error 9: subscript out of range (when error handling is not
used). I thought it might be to do with workbooks(path), but not sure. It is
located in the ThisWorkbook object.



Private Sub workbook_open()

'sub to force intermediate xlwb to update its links without opening it

'Dim msg As String

On Error GoTo ms

with Workbooks("G:\filepath\filepath\file.xls")

.UpdateLink Name:=.LinkSources

end with

Exit Sub

ms:
msg = "links may have not updated properly" & vbNewLine
msg = msg & "open relevant file"
MsgBox msg


End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default why won't this work?

In the source workbook go to Edit, Links. Click on the Startup Prompt button
and change the setting to 'Dont display the alert and update the links'.

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"PBcorn" wrote:

excellent - that works. If you have time - is there a way of stopping the
update links dialog box from appearing when the file is opened?

Thanks

"Alan Moseley" wrote:

From the help file, the Workbooks property:-

Returns a Workbooks collection that represents all the open workbooks.

Try changing your line to:-

With Workbooks.Open("G:\filepath\filepath\file.xls")

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"PBcorn" wrote:

The below gives error 9: subscript out of range (when error handling is not
used). I thought it might be to do with workbooks(path), but not sure. It is
located in the ThisWorkbook object.



Private Sub workbook_open()

'sub to force intermediate xlwb to update its links without opening it

'Dim msg As String

On Error GoTo ms

with Workbooks("G:\filepath\filepath\file.xls")

.UpdateLink Name:=.LinkSources

end with

Exit Sub

ms:
msg = "links may have not updated properly" & vbNewLine
msg = msg & "open relevant file"
MsgBox msg


End Sub

Reply
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 TO MAKE A LIST OF WORK SHEET IN WORK BOOK IN EXCEL 2007 goutam Excel Programming 1 February 1st 08 07:40 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
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


All times are GMT +1. The time now is 06:27 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"