Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default access closed workbook


I have a spreadsheet that accesses aproximately 30 other workbooks and
returnd data from them. My problem is that the routine that gets the
info opens the workbooks first. Many of these workbooks have broken
links and I have to click on a prompt before the Macro will continue to
the next file. I was hoping someone knows how to either force the macro
to stop the prompt for the broken link or how to access the workbooks
without opening them first. Below is the code I have to retrieve the
information. Any help would be greatly appreciated.

Thanks
Goober.


Sub BubbleNumbers()
Dim basebook As Workbook
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim SourceRcount As Long
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String
Dim SheetNumber
SheetNumber = InputBox("Please enter the day you want to retrieve data
for. Example: For the first day enter 1.")
If SheetNumber < 1 Then
Call Noise
MsgBox "You must enter a number between 1 and 31"
Exit Sub
End If

If SheetNumber 31 Then
Call Noise
MsgBox "You must enter a number between 1 and 31"
Exit Sub
End If

SaveDriveDir = CurDir
MyPath = "S:\ROSTER MANAGEMENT\GRAVES\GRAVES 2005\October 05"
ChDrive MyPath
ChDir MyPath

FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Set basebook = ThisWorkbook
basebook.Worksheets(1).Cells.Clear
rnum = 1

Do While FNames < ""
Set mybook = Workbooks.Open(FNames)
Set sourceRange =
mybook.Worksheets(SheetNumber).Range("W104:AF109")
SourceRcount = sourceRange.Rows.Count
Set destrange = basebook.Worksheets(1).Cells(rnum, "A")

basebook.Worksheets(1).Cells(rnum, "k").Value = mybook.Name
sourceRange.Copy destrange
mybook.Close False
rnum = rnum + SourceRcount
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub


--
goober
------------------------------------------------------------------------
goober's Profile: http://www.excelforum.com/member.php...o&userid=19838
View this thread: http://www.excelforum.com/showthread...hreadid=475076

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default access closed workbook

Don't know if it's of any help, but to have a Master workbook access
other closed workbooks through formulas, use similar syntax to:

='C:\Documents and Settings\WORK\Daily
Scheduling\[Calendar.xls]October'!$E$14

and then set your Macro to read from the one Master workbook.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default access closed workbook


Thanks for the help. It's nice to not have the annoying question
anymore

--
goobe
-----------------------------------------------------------------------
goober's Profile: http://www.excelforum.com/member.php...fo&userid=1983
View this thread: http://www.excelforum.com/showthread.php?threadid=47507

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
Access Closed workbooks (2003) jmack Excel Worksheet Functions 3 January 26th 06 10:14 PM
Closing Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Access closed workbook range in Custom functions agarwaldvk[_5_] Excel Programming 6 July 9th 04 09:33 AM
Access closed workbook range in Custom functions agarwaldvk[_4_] Excel Programming 1 July 8th 04 03:50 AM


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