How to access local folder over network

egalitarian

New Member
Joined
Jul 23, 2010
Messages
1
Dear Experts,

i have an excel file that reads directory data from a certain folder. Since its in my local machine, it works great as required.

However, the problem now is that i am going to put the excel file in network drive so that my other colleague can access it too. its function will still be the same and that is to read data from my local drive.

The following is my code. Please kindly enlighten me as to how make my file read my local data across the network? Any kind of help will be greatly appreciated. I am using Excel 2003.

******Code*******

Sub getReleaseFolderName()
Dim xRow&, vSF
Dim yRow&, wSF
Dim xDirect$, InitialFoldr$
Dim FSO
Dim itemNo As Integer
Dim folderNameCell

' Startup folder to begin searching from
InitialFoldr$ = "C:\Releases\Release 3\Releases"
Sheet3.Activate

'Confirm if the folder exists
Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FolderExists(InitialFoldr$) Then
MsgBox InitialFoldr$ & " do not exists! Check Settings Worksheet.", vbExclamation, "Folder Do Not Exists"
Else
xDirect$ = InitialFoldr$ & "\"
End If

'If the folder exists, look for files, subfolders and print out their name
If xDirect$ <> "" Then
With CreateObject("Scripting.FileSystemObject").GetFolder(xDirect$)
For Each vSF In .SubFolders
Range("A11").Offset(xRow) = itemNo + 1
Range("B11").Offset(xRow) = vSF.DateCreated
Range("C11").Offset(xRow) = vSF.Name
With CreateObject("Scripting.FileSystemObject").GetFolder(vSF)
For Each wSF In .Files
If wSF.Type = "Adobe Acrobat Document" Then
' Add hyperlinks to files
ActiveSheet.Hyperlinks.Add Anchor:=Range("D11").Offset(yRow), Address:= _
wSF, TextToDisplay:=wSF.Name
Else
Range("D11").Offset(yRow) = wSF.Name
End If
yRow = yRow + 1
Next wSF
For Each wSF In .SubFolders
ActiveSheet.Hyperlinks.Add Anchor:=Range("D11").Offset(yRow), Address:= _
wSF, TextToDisplay:=wSF.Name
yRow = yRow + 1
Next wSF
End With
xRow = yRow
itemNo = itemNo + 1
Next vSF
End With
End If
End Sub
******* End Code*****
 
Last edited:

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Derek Brown

Well-known Member
Joined
Dec 26, 2005
Messages
2,390
Hello and welcome to The Board.
I believe that it is possible to set up a 'network share' but I have never come across that being used in a work environment. Personally I would not be too happy with that.
For what you want to do I would consider adding code to my workbook(s) to copy it to the network drive (where it would be accessible) wheneve I saved it.
 

PCRIDE

Well-known Member
Joined
Jan 20, 2008
Messages
892
Use the excel data connections rather than the code pulling the data.

Create your raw data table, store it on the network. In your excel sheet click on the Data--> Connections Option. You can connect to SQL, Access, Excel, TXT files etc...
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,365
Messages
5,510,868
Members
408,816
Latest member
ashcraft

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top