|
-
May 5th, 2011, 05:39 AM
#1
Thread Starter
New Member
Gathering Data from a NetWork File
HI all,
I need your experiance to overcome what I originaly thought was a simple issue.
I need to Pull Data from an open workbook on a network PC, without opening the workbook on my PC. I have the following code which deterimins if the Workbook is Open on the Target Network Drive, but I'm stuck on how to upload / copy in essence Data from it?
Sub Network_File_Open()
Const strFileToOpen As String = "Q:\PathName\Filename1.xlsm"
If IsFileOpen(strFileToOpen) Then
MsgBox strFileToOpen & " is already Open"
Else
MsgBox strFileToOpen & " is not open", vbInformation
End If
End Sub
Function IsFileOpen(strFullPathFileName As String) As Boolean
Dim hdlFile As Long
'Error is generated if you try
'opening a File for ReadWrite lock >> MUST BE OPEN!
On Error GoTo FileIsOpen:
hdlFile = FreeFile
Open strFullPathFileName For Random Access Read Write Lock Read Write As hdlFile
IsFileOpen = False
Close hdlFile
Exit Function
FileIsOpen:
'Someone has it open!
IsFileOpen = True
Close hdlFile
End Function
The above function works fine how do I now pull data from say Sheet7.Range("A1:G75") , Could be smaller or larger though: and then copy it into my workbook. or enter values into an array on my workbook.
Hoping you can assist
Lee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|