Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Merge data from sharepoint workbooks

Hi All,
I'm am using Ron de Bruin's code to Merge Data from all workbooks in a
folder. The workbooks that I have been merging have been moved onto
sharepoint and I need to update my macro to deal with this. I need to allow
users to browse to the sharepoint folder as the name will change each month.
My attempts to update the code (shown below) allows the user to browse
sharepoint but I can't make a selection until I get to an individual excel
file (and I want to select all files within a folder, including any
subfolders) and then I get an error messsage. (RDB's brilliant code calls on
other macros which I haven't copied here.)
Can anyone help??
Thanks lots
P
Sub ConsolidateDetail()
Dim MyFiles As Variant
Dim myCountOfFiles As Long
Dim oApp As Object
Dim oFolder As Variant

Set oApp = CreateObject("InternetExplorer.Application")
oApp.Visible = True

'Change ScreenUpdating, Calculation and EnableEvents
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
.EnableEvents = False
End With

'Browse to the folder
Set oFolder = oApp.BrowseForFolder(0, "Select folder", 512)

If Not oFolder Is Nothing Then

myCountOfFiles = Get_File_Names( _
MyPath:=oFolder.Self.Path, _
Subfolders:=True, _
ExtStr:="*.xl*", _
myReturnedFiles:=MyFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="Move", _
SourceShIndex:=1, _
SourceRng:="", _
StartCell:="A27", _
myReturnedFiles:=MyFiles

End If

'Restore ScreenUpdating, Calculation and EnableEvents
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = CalcMode
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Merge data from sharepoint workbooks

If your users have access to the sharepoint site itself, then they have
access to the "regular" directory structure as well. Basically, treat it like
they are on a network drive, with a path that starts with 'share'; ask your
IT department for the exact path- ours is:
share.ourcompanyname\directory\subdirectory

Then you can use standard coding to select directories and process files,
without having to use IE and access these files via a web interface.

Note: This approach works for a sharepoint site within our company, but I
haven't tried accessing "public" sharepoint sites from outside a company or
firewall

HTH,
Keith


Option Explicit
Global asd 'variant 1-D array

Sub SrchForFiles()
Dim fldr As String

fldr = "\\share.ourcompany.com\finance\bxcs\"
asd = ListFiles(fldr, True)
etc.


"PJ71" wrote:

Hi All,
I'm am using Ron de Bruin's code to Merge Data from all workbooks in a
folder. The workbooks that I have been merging have been moved onto
sharepoint and I need to update my macro to deal with this. I need to allow
users to browse to the sharepoint folder as the name will change each month.
My attempts to update the code (shown below) allows the user to browse
sharepoint but I can't make a selection until I get to an individual excel
file (and I want to select all files within a folder, including any
subfolders) and then I get an error messsage. (RDB's brilliant code calls on
other macros which I haven't copied here.)
Can anyone help??
Thanks lots
P
Sub ConsolidateDetail()
Dim MyFiles As Variant
Dim myCountOfFiles As Long
Dim oApp As Object
Dim oFolder As Variant

Set oApp = CreateObject("InternetExplorer.Application")
oApp.Visible = True

'Change ScreenUpdating, Calculation and EnableEvents
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
.EnableEvents = False
End With

'Browse to the folder
Set oFolder = oApp.BrowseForFolder(0, "Select folder", 512)

If Not oFolder Is Nothing Then

myCountOfFiles = Get_File_Names( _
MyPath:=oFolder.Self.Path, _
Subfolders:=True, _
ExtStr:="*.xl*", _
myReturnedFiles:=MyFiles)

If myCountOfFiles = 0 Then
MsgBox "No files that match the ExtStr in this folder"
Exit Sub
End If

Get_Data _
FileNameInA:=True, _
PasteAsValues:=True, _
SourceShName:="Move", _
SourceShIndex:=1, _
SourceRng:="", _
StartCell:="A27", _
myReturnedFiles:=MyFiles

End If

'Restore ScreenUpdating, Calculation and EnableEvents
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = CalcMode
End With
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
Retrieve excel data from multiple workbooks in sharepoint luvgreen Excel Programming 0 February 25th 09 09:08 PM
Merge data from different workbooks Obonden Excel Discussion (Misc queries) 1 February 23rd 09 09:46 PM
I want to merge data from 2 different workbooks Shin Excel Worksheet Functions 0 October 13th 06 02:27 PM
how do i merge data from specific cells to different workbooks? Rich Excel Worksheet Functions 1 September 22nd 06 03:33 PM
Excel: how to merge data from 2 workbooks with 1 col. in common? Cesare Excel Discussion (Misc queries) 2 June 24th 05 11:14 PM


All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"