PC Review


Reply
Thread Tools Rate Thread

Compare xls & mpp files against a master file register then flag missing.

 
 
Roger from Auckland
Guest
Posts: n/a
 
      17th Sep 2007
Hi,
Excel 2003
On either a weekly or fortnightly cycle, I have to check against a
master register of file names, files that may or may not exist in two
separate locations on a shared drive, and flag up files that should be
there.
One folder contains xls files, the second folder contains mpp files.
I need to bring the names of these files into a spreadsheet, then
compare against the master file registry.
Can anyone point me to a macro which could show me the right steps to
take?

Regards
Roger

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      17th Sep 2007
Sub getfilenames()
Dim s as String, rw as Long
Dim fname as String
s = "C:\Myfolder\"

rw = 1
fname = Dir(s & "*.xls")
do while fname <> ""
cells(rw,1) = fname
rw = rw + 1
fname = dir()
Loop
s = "C:\Myfolder1"
rw = 1
fname = Dir(s & "*.mpp")
do while fname <> ""
cells(rw,1) = fname
rw = rw + 1
fname = dir()
Loop
End Sub

--
regards,
Tom Ogilvy


"Roger from Auckland" wrote:

> Hi,
> Excel 2003
> On either a weekly or fortnightly cycle, I have to check against a
> master register of file names, files that may or may not exist in two
> separate locations on a shared drive, and flag up files that should be
> there.
> One folder contains xls files, the second folder contains mpp files.
> I need to bring the names of these files into a spreadsheet, then
> compare against the master file registry.
> Can anyone point me to a macro which could show me the right steps to
> take?
>
> Regards
> Roger
>
>

 
Reply With Quote
 
Roger
Guest
Posts: n/a
 
      17th Sep 2007
On Sep 17, 11:12 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
wrote:
> Sub getfilenames()
> Dim s as String, rw as Long
> Dim fname as String
> s = "C:\Myfolder\"
>
> rw = 1
> fname = Dir(s & "*.xls")
> do while fname <> ""
> cells(rw,1) = fname
> rw = rw + 1
> fname = dir()
> Loop
> s = "C:\Myfolder1"
> rw = 1
> fname = Dir(s & "*.mpp")
> do while fname <> ""
> cells(rw,1) = fname
> rw = rw + 1
> fname = dir()
> Loop
> End Sub
>
> --
> regards,
> Tom Ogilvy
>
> "Roger from Auckland" wrote:
> > Hi,
> > Excel 2003
> > On either a weekly or fortnightly cycle, I have to check against a
> > master register of file names, files that may or may not exist in two
> > separate locations on a shared drive, and flag up files that should be
> > there.
> > One folder contains xls files, the second folder contains mpp files.
> > I need to bring the names of these files into a spreadsheet, then
> > compare against the master file registry.
> > Can anyone point me to a macro which could show me the right steps to
> > take?

>
> > Regards
> > Roger


Tom, thanks for taking the time out to reply.
I installed the macro and ran it with no results so I'm just checking
that I've not snafooed things.

Sub getfilenames()
Dim s as String, rw as Long
Dim fname as String
s = "C:\Myfolder\"

The s="C:\Myfolder\" I've understood to be the two locations for the
*.xls and *.mpp files, so I copied the appropriate location into the
macro.
Is this all that is required?
What is the expected outcome? i.e. should I get two sets of files,
one set the *.xls, and below that the other set *.mpp?

How do I send the output of the macro to put the *.xls files in say
B10 and the output of the *.mpp files into D10?

Again, thanks for your help...

Incidentally, is there a good primer/PDF on the net explaining in
simple terms an overview of the Macro/VB usage in Excel? The internal
help file is not so user friendly.

Regards
Roger

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      17th Sep 2007
The output of Tom's original code would have been placed on the activesheet. So
clean that sheet up before you start (or insert a new worksheet first???).

And you should have changed those two lines "S=...." to point at the correct
folders. Did you include the final backslash?

Option Explicit
Sub getfilenames()
Dim s As String, rw As Long
Dim fname As String
s = "C:\folder1\"

rw = 10
fname = Dir(s & "*.xls")
Do While fname <> ""
Cells(rw, "b") = fname
rw = rw + 1
fname = Dir()
Loop
s = "c:\folder2\"
rw = 10
fname = Dir(s & "*.mpp")
Do While fname <> ""
Cells(rw, "D") = fname
rw = rw + 1
fname = Dir()
Loop
End Sub

There was a minor bug in Tom's first response.

That second "rw = 1" start the output at row 1 (column A) and may have
overwritten any .xls filenames that would have been there.

In the new code, you want to start back at row 10, but in a different column.

If it doesn't work for you, then post the code you used. It'll make finding any
errors easier.

Roger wrote:
>
> On Sep 17, 11:12 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
> wrote:
> > Sub getfilenames()
> > Dim s as String, rw as Long
> > Dim fname as String
> > s = "C:\Myfolder\"
> >
> > rw = 1
> > fname = Dir(s & "*.xls")
> > do while fname <> ""
> > cells(rw,1) = fname
> > rw = rw + 1
> > fname = dir()
> > Loop
> > s = "C:\Myfolder1"
> > rw = 1
> > fname = Dir(s & "*.mpp")
> > do while fname <> ""
> > cells(rw,1) = fname
> > rw = rw + 1
> > fname = dir()
> > Loop
> > End Sub
> >
> > --
> > regards,
> > Tom Ogilvy
> >
> > "Roger from Auckland" wrote:
> > > Hi,
> > > Excel 2003
> > > On either a weekly or fortnightly cycle, I have to check against a
> > > master register of file names, files that may or may not exist in two
> > > separate locations on a shared drive, and flag up files that should be
> > > there.
> > > One folder contains xls files, the second folder contains mpp files.
> > > I need to bring the names of these files into a spreadsheet, then
> > > compare against the master file registry.
> > > Can anyone point me to a macro which could show me the right steps to
> > > take?

> >
> > > Regards
> > > Roger

>
> Tom, thanks for taking the time out to reply.
> I installed the macro and ran it with no results so I'm just checking
> that I've not snafooed things.
>
> Sub getfilenames()
> Dim s as String, rw as Long
> Dim fname as String
> s = "C:\Myfolder\"
>
> The s="C:\Myfolder\" I've understood to be the two locations for the
> *.xls and *.mpp files, so I copied the appropriate location into the
> macro.
> Is this all that is required?
> What is the expected outcome? i.e. should I get two sets of files,
> one set the *.xls, and below that the other set *.mpp?
>
> How do I send the output of the macro to put the *.xls files in say
> B10 and the output of the *.mpp files into D10?
>
> Again, thanks for your help...
>
> Incidentally, is there a good primer/PDF on the net explaining in
> simple terms an overview of the Macro/VB usage in Excel? The internal
> help file is not so user friendly.
>
> Regards
> Roger


--

Dave Peterson
 
Reply With Quote
 
Roger
Guest
Posts: n/a
 
      18th Sep 2007
On Sep 18, 9:47 am, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> The output of Tom's original code would have been placed on the activesheet. So
> clean that sheet up before you start (or insert a new worksheet first???).
>
> And you should have changed those two lines "S=...." to point at the correct
> folders. Did you include the final backslash?
>
> Option Explicit
> Sub getfilenames()
> Dim s As String, rw As Long
> Dim fname As String
> s = "C:\folder1\"
>
> rw = 10
> fname = Dir(s & "*.xls")
> Do While fname <> ""
> Cells(rw, "b") = fname
> rw = rw + 1
> fname = Dir()
> Loop
> s = "c:\folder2\"
> rw = 10
> fname = Dir(s & "*.mpp")
> Do While fname <> ""
> Cells(rw, "D") = fname
> rw = rw + 1
> fname = Dir()
> Loop
> End Sub
>
> There was a minor bug in Tom's first response.
>
> That second "rw = 1" start the output at row 1 (column A) and may have
> overwritten any .xls filenames that would have been there.
>
> In the new code, you want to start back at row 10, but in a different column.
>
> If it doesn't work for you, then post the code you used. It'll make finding any
> errors easier.
>
>
>
> Roger wrote:
>
> > On Sep 17, 11:12 pm, Tom Ogilvy <TomOgi...@discussions.microsoft.com>
> > wrote:
> > > Sub getfilenames()
> > > Dim s as String, rw as Long
> > > Dim fname as String
> > > s = "C:\Myfolder\"

>
> > > rw = 1
> > > fname = Dir(s & "*.xls")
> > > do while fname <> ""
> > > cells(rw,1) = fname
> > > rw = rw + 1
> > > fname = dir()
> > > Loop
> > > s = "C:\Myfolder1"
> > > rw = 1
> > > fname = Dir(s & "*.mpp")
> > > do while fname <> ""
> > > cells(rw,1) = fname
> > > rw = rw + 1
> > > fname = dir()
> > > Loop
> > > End Sub

>
> > > --
> > > regards,
> > > Tom Ogilvy

>
> > > "Roger from Auckland" wrote:
> > > > Hi,
> > > > Excel 2003
> > > > On either a weekly or fortnightly cycle, I have to check against a
> > > > master register of file names, files that may or may not exist in two
> > > > separate locations on a shared drive, and flag up files that should be
> > > > there.
> > > > One folder contains xls files, the second folder contains mpp files.
> > > > I need to bring the names of these files into a spreadsheet, then
> > > > compare against the master file registry.
> > > > Can anyone point me to a macro which could show me the right steps to
> > > > take?

>
> > > > Regards
> > > > Roger

>
> > Tom, thanks for taking the time out to reply.
> > I installed the macro and ran it with no results so I'm just checking
> > that I've not snafooed things.

>
> > Sub getfilenames()
> > Dim s as String, rw as Long
> > Dim fname as String
> > s = "C:\Myfolder\"

>
> > The s="C:\Myfolder\" I've understood to be the two locations for the
> > *.xls and *.mpp files, so I copied the appropriate location into the
> > macro.
> > Is this all that is required?
> > What is the expected outcome? i.e. should I get two sets of files,
> > one set the *.xls, and below that the other set *.mpp?

>
> > How do I send the output of the macro to put the *.xls files in say
> > B10 and the output of the *.mpp files into D10?

>
> > Again, thanks for your help...

>
> > Incidentally, is there a good primer/PDF on the net explaining in
> > simple terms an overview of the Macro/VB usage in Excel? The internal
> > help file is not so user friendly.

>
> > Regards
> > Roger

>
> --
>
> Dave Peterson


Dave hi,
Problem fixed with the inclusion of the final "\"....
Thanks a mill.
Roger...

 
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
Open files from a file register RocketRod Microsoft Excel Programming 7 7th Jun 2009 12:17 AM
RE: Open files from a file register Joel Microsoft Excel Programming 0 6th Jun 2009 05:19 AM
Master Document Subdoc Files Missing =?Utf-8?B?QmlsYmVydA==?= Microsoft Word Document Management 1 13th Jun 2007 07:39 PM
Register refers to a missing file mike carrington Windows XP Help 1 20th Aug 2006 08:21 PM
register for COM interop flag doesn't work ... zzozo Microsoft Outlook Program Addins 1 20th May 2005 11:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 PM.