LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Get info from a file that is already open

Dear users,

I have the following macro, which is working fine (surely, there can
be improvement):

Private Sub CommandButtonUpdate_Click()

Dim i As Integer
Dim j As Integer
Dim idString As String
Dim sFilePath As String
Dim NameStaff As String
Dim wbNew As Workbook
Dim wb As Workbook
Set wb = ActiveWorkbook

Application.ScreenUpdating = False

For i = 1 To 32

j = i + 7
idString = ActiveSheet.Range("C" & j).Text
If idString < "" Then
sFilePath = "L:\Year Planner\PresenceCheck\users\" & idString
Application.DisplayAlerts = False
Workbooks.Open sFilePath
Set wbNew = ActiveWorkbook
wb.Sheets(1).Range("D" & j).Value =
wbNew.Sheets(1).Range("D9").Value
wb.Sheets(1).Range("E" & j).Value =
wbNew.Sheets(1).Range("D20").Value
wbNew.Close
End If
Next

Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

My problem: the purpose of this macro is to go into each staffs own
Excel file (all saved on server) to get the info

wb.Sheets(1).Range("D" & j).Value =
wbNew.Sheets(1).Range("D9").Value
wb.Sheets(1).Range("E" & j).Value =
wbNew.Sheets(1).Range("D20").Value

However, our staff has opened these files all the time. As soon as a
file is already opened, the update does not work anymore.
How can I avoid this problem (I guess it is read-only). PLEASE HELP!

Thanks a lot.

Regards,

Rico

 
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
delete info from source file w/out changing the destination file TB New Users to Excel 0 May 26th 08 06:26 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
open workbooks to extract info into one Saz[_8_] Excel Programming 1 June 7th 06 07:49 PM
Open a file do a macro ( made) and open next succesive file SVTman74 Excel Programming 5 April 21st 06 10:14 PM
Open a text file and get the info Gary Adamson Excel Programming 0 August 21st 03 11:10 PM


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