PC Review


Reply
Thread Tools Rate Thread

all worksheets into one workbook

 
 
=?Utf-8?B?ZXhjZWwtdHI=?=
Guest
Posts: n/a
 
      28th Mar 2007
Hi,

I have lots of workbooks having worksheets in different folders.How can I
save all worksheets in different workbooks into one new workbook ?

regards.
--
SAHRAYICEDIT-ISTANBUL
 
Reply With Quote
 
 
 
 
=?Utf-8?B?ZXhjZWwtdHI=?=
Guest
Posts: n/a
 
      28th Mar 2007
Hi,

I tried the code, but it does not help me.any idea ?
--
SAHRAYICEDIT-ISTANBUL


"Joel":

> Below is code from the VBA help menu.
>
>
> Sub SearchEveryFolder()
>
> 'Declare variables that reference a
> 'SearchScope and a ScopeFolder object.
> Dim ss As SearchScope
> Dim sf As ScopeFolder
>
> 'Declare a variable to act as a generic counter.
> Dim lngCount As Long
>
> 'Use a With...End With block to reference the
> 'FileSearch object.
> With Application.FileSearch
>
> 'Clear all the parameters of the previous searches.
> 'This method doesn't clear the LookIn property or
> 'the SearchFolders collection.
> .NewSearch
>
> 'Specify the type of file for which to search.
> 'Use the FileType property to specify the first type
> 'and then add additional types to the FileTypes collection.
> .FileType = msoFileTypeWebPages
> .FileTypes.Add msoFileTypeExcelWorkbooks
>
> 'Clear the SearchFolder collection by
> 'looping through each ScopeFolder object
> 'and removing it.
> For lngCount = 1 To .SearchFolders.Count
> .SearchFolders.Remove lngCount
> Next lngCount
>
> 'Loop through the SearchScopes collection to find
> 'the scope in which you want to search. In this
> 'case the scope is the local machine.
> For Each ss In .SearchScopes
> Select Case ss.Type
> Case msoSearchInMyComputer
>
> 'Loop through each ScopeFolder in
> 'the ScopeFolders collection of the
> 'SearchScope object.
> For Each sf In ss.ScopeFolder.ScopeFolders
>
> 'Call a function that loops through all
> 'of the subfolders of the root ScopeFolder.
> 'This function adds any folders named "1033" to the
> 'SearchFolders collection.
> Call OutputPaths(sf.ScopeFolders, "1033")
>
> Next sf
> Case Else
> End Select
> Next ss
>
> 'Test to see if any ScopeFolders collections were added to
> 'the SearchFolders collection.
> If .SearchFolders.Count > 0 Then
>
> 'Set the LookIn property to the path of
> 'the first ScopeFolder object in the SearchFolders
> 'collection. This is here so that any previous
> 'setting of the LookIn property doesn't affect
> 'the search.
> .LookIn = .SearchFolders.Item(1).Path
>
> 'Execute the search and test to see if any files
> 'were found.
> If .Execute <> 0 Then
>
> 'Display the number of files found.
> MsgBox "Files found: " & .FoundFiles.Count
>
> 'Loop through the list of found files and
> 'display the path of each one in a message box.
> For lngCount = 1 To .FoundFiles.Count
> If MsgBox(.FoundFiles.Item(lngCount), vbOKCancel, _
> "Found files") = vbCancel Then
> 'Break out of the loop
> lngCount = .FoundFiles.Count
>
> End If
> Next lngCount
> End If
> End If
> End With
> End Sub
>
> 'This subroutine loops through all of the ScopeFolders collections
> 'in a given ScopeFolders collection. It adds any folder
> 'that has the same name as the value of strFolder
> 'to the SearchFolders collection.
> Sub OutputPaths(ByVal sfs As ScopeFolders, _
> ByRef strFolder As String)
>
> 'Declare a variable as a ScopeFolder object
> Dim sf As ScopeFolder
>
> 'Loop through each ScopeFolder object in the
> 'ScopeFolders collection.
> For Each sf In sfs
>
> 'Test to see if the folder name of the ScopeFolder
> 'matches the value of strFolder. Use LCase to ensure
> 'that case does not affect the match.
> If LCase(sf.Name) = LCase(strFolder) Then
>
> 'Add the ScopeFolder to the SearchFolders collection.
> sf.AddToSearchFolders
>
> End If
>
> 'Include a DoEvents call because there is the potential for this
> 'loop to last a long time. The DoEvents call allows this process to
> 'continue handling events.
> DoEvents
>
> 'Test to see if the ScopeFolders collection in the
> 'current ScopeFolder is empty. If it isn't empty, then
> 'that means that the current ScopeFolder object contains subfolders.
> If sf.ScopeFolders.Count > 0 Then
>
> 'This subroutine recursively calls itself so that
> 'it can add the subfolders of the current ScopeFolder object
> 'to the SearchFolders collection.
> Call OutputPaths(sf.ScopeFolders, strFolder)
>
> End If
> Next sf
> End Sub
>
>
> "excel-tr" wrote:
>
> > Hi,
> >
> > I have lots of workbooks having worksheets in different folders.How can I
> > save all worksheets in different workbooks into one new workbook ?
> >
> > regards.
> > --
> > SAHRAYICEDIT-ISTANBUL

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      28th Mar 2007
Hi SAHRAYICEDIT

Start here
http://www.rondebruin.nl/copy3.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"excel-tr" <(E-Mail Removed)> wrote in message news:93A3CD00-7823-4A2A-926A-(E-Mail Removed)...
> Hi,
>
> I have lots of workbooks having worksheets in different folders.How can I
> save all worksheets in different workbooks into one new workbook ?
>
> regards.
> --
> SAHRAYICEDIT-ISTANBUL

 
Reply With Quote
 
=?Utf-8?B?ZXhjZWwtdHI=?=
Guest
Posts: n/a
 
      29th Mar 2007
hi,

to include subfolders, what is the revised code for 11th example ?
--
SAHRAYICEDIT-ISTANBUL


"Ron de Bruin":

> Hi SAHRAYICEDIT
>
> Start here
> http://www.rondebruin.nl/copy3.htm
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "excel-tr" <(E-Mail Removed)> wrote in message news:93A3CD00-7823-4A2A-926A-(E-Mail Removed)...
> > Hi,
> >
> > I have lots of workbooks having worksheets in different folders.How can I
> > save all worksheets in different workbooks into one new workbook ?
> >
> > regards.
> > --
> > SAHRAYICEDIT-ISTANBUL

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      29th Mar 2007
See this link on the page
http://www.rondebruin.nl/fso.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"excel-tr" <(E-Mail Removed)> wrote in message news:B905D02D-022F-4EED-91B3-(E-Mail Removed)...
> hi,
>
> to include subfolders, what is the revised code for 11th example ?
> --
> SAHRAYICEDIT-ISTANBUL
>
>
> "Ron de Bruin":
>
>> Hi SAHRAYICEDIT
>>
>> Start here
>> http://www.rondebruin.nl/copy3.htm
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl/tips.htm
>>
>>
>> "excel-tr" <(E-Mail Removed)> wrote in message news:93A3CD00-7823-4A2A-926A-(E-Mail Removed)...
>> > Hi,
>> >
>> > I have lots of workbooks having worksheets in different folders.How can I
>> > save all worksheets in different workbooks into one new workbook ?
>> >
>> > regards.
>> > --
>> > SAHRAYICEDIT-ISTANBUL

>>

 
Reply With Quote
 
=?Utf-8?B?ZXhjZWwtdHI=?=
Guest
Posts: n/a
 
      29th Mar 2007
hi,

ok, but how can I revise it for just copying the sheets without ranges ?
--
SAHRAYICEDIT-ISTANBUL


"Ron de Bruin":

> See this link on the page
> http://www.rondebruin.nl/fso.htm
>
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "excel-tr" <(E-Mail Removed)> wrote in message news:B905D02D-022F-4EED-91B3-(E-Mail Removed)...
> > hi,
> >
> > to include subfolders, what is the revised code for 11th example ?
> > --
> > SAHRAYICEDIT-ISTANBUL
> >
> >
> > "Ron de Bruin":
> >
> >> Hi SAHRAYICEDIT
> >>
> >> Start here
> >> http://www.rondebruin.nl/copy3.htm
> >>
> >> --
> >>
> >> Regards Ron de Bruin
> >> http://www.rondebruin.nl/tips.htm
> >>
> >>
> >> "excel-tr" <(E-Mail Removed)> wrote in message news:93A3CD00-7823-4A2A-926A-(E-Mail Removed)...
> >> > Hi,
> >> >
> >> > I have lots of workbooks having worksheets in different folders.How can I
> >> > save all worksheets in different workbooks into one new workbook ?
> >> >
> >> > regards.
> >> > --
> >> > SAHRAYICEDIT-ISTANBUL
> >>

>

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      1st Apr 2007
You already have the code that do the copy.

I see I have time to make a example for you today

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"excel-tr" <(E-Mail Removed)> wrote in message news:470B6C6B-013B-48F3-9ED7-(E-Mail Removed)...
> hi,
>
> ok, but how can I revise it for just copying the sheets without ranges ?
> --
> SAHRAYICEDIT-ISTANBUL
>
>
> "Ron de Bruin":
>
>> See this link on the page
>> http://www.rondebruin.nl/fso.htm
>>
>>
>> --
>>
>> Regards Ron de Bruin
>> http://www.rondebruin.nl/tips.htm
>>
>>
>> "excel-tr" <(E-Mail Removed)> wrote in message news:B905D02D-022F-4EED-91B3-(E-Mail Removed)...
>> > hi,
>> >
>> > to include subfolders, what is the revised code for 11th example ?
>> > --
>> > SAHRAYICEDIT-ISTANBUL
>> >
>> >
>> > "Ron de Bruin":
>> >
>> >> Hi SAHRAYICEDIT
>> >>
>> >> Start here
>> >> http://www.rondebruin.nl/copy3.htm
>> >>
>> >> --
>> >>
>> >> Regards Ron de Bruin
>> >> http://www.rondebruin.nl/tips.htm
>> >>
>> >>
>> >> "excel-tr" <(E-Mail Removed)> wrote in message news:93A3CD00-7823-4A2A-926A-(E-Mail Removed)...
>> >> > Hi,
>> >> >
>> >> > I have lots of workbooks having worksheets in different folders.How can I
>> >> > save all worksheets in different workbooks into one new workbook ?
>> >> >
>> >> > regards.
>> >> > --
>> >> > SAHRAYICEDIT-ISTANBUL
>> >>

>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Copy all worksheets to another workbook, excl. duplicate sheets already in other workbook Chip Pearson Microsoft Excel Programming 0 26th May 2009 04:27 PM
Combine worksheets in multiple workbook in one workbook with a macro Sam Commar Microsoft Excel Misc 2 2nd Apr 2009 01:09 PM
saving 3 worksheets in a workbook to a separte workbook bigjim Microsoft Excel Programming 6 5th Nov 2008 10:12 PM
copying worksheets to a new workbook without formulae referencing original workbook pjdeeb@gmail.com Microsoft Excel Programming 2 16th Oct 2006 07:31 PM
Link multiple worksheets in one workbook to another workbook and . =?Utf-8?B?SGVhdGhlckNhcnI=?= Microsoft Excel Programming 0 28th Mar 2005 10:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:19 AM.