View Single Post
  #8  
Old October 6th, 2004, 04:38 AM
Jay Freedman
external usenet poster
 
Posts: n/a
Default

OK, we're starting to get somewhere. I'm going to have to rely on you
to continue debugging. As I said before, the macro runs properly on my
system, but I obviously don't have the same set of folders and files
you do.

First, here are some things that are *not* wrong, based on your
description:
- The references are correct. The macro starts, and the
FileSystemObject (the object named fs) is being created.
- The dialog is being presented to pick the topmost folder.
- There are no "syntax errors" (that is, instructions that have typing
errors or incorrect structure), which would be highlighted in red.
- The presence or absence of blank lines in the code is immaterial.
- The solid line between subroutines (that is, before a Sub line or
after an End Sub line) is normal and expected.

What appears to be happening is that the folder name supplied by the
dialog is incorrect in some way.

A 'path not found' error can mean literally that the path named by the
variable PathToUse doesn't exist, but that's very improbable because
you aren't typing the name, so there's no opportunity for a typing
error. It might mean that the variable's value contains a doubled
backslash or an invalid character. It could mean that there's a
problem with the permissions granted to you in that folder, or that
there's something wrong with the network (if the folder is on a server
or another machine).

Run the macro the same way again. When the error message pops up and
you click the Debug button, hover the mouse over the word PathToUse.
You should see a tooltip that shows the value of that variable. If you
have trouble getting that, then right-click the word and choose Add
Watch, click OK in the resulting dialog, and look at the Watch window
that opens at the bottom of the editor.

Examine the value of PathToUse to see if you can figure out what's
wrong with it. Try running the macro again and choosing a different
folder in the dialog, to see if it's something about the first one's
name or permissions or location. Post back and show me the values you
found.

--
Regards,
Jay Freedman http://aspnet2.com/mvp.ashx?JayFreedman
Microsoft Word MVP FAQ: http://word.mvps.org

(helpserv) wrote:

In response to your query regarding the exact nature and error:

The following was done already- selected the reference as requested,
and then copied directly from here the suggested code, pasted it into
notepad, pasted it into Microsoft Visual Basic Editor with NO
MODIFICATIONS TO THE CODE.

Then selected from the Tools bar, Macro, in WORD 2003 and OFFICE 2003
using XP professional as the operating system. Then selected MACRO it
opened a window where I then selected the name of the macro and then
RUN. The Macro then opened a window entitled COPY, inside it were
folders to look in and then I selected a folder with documents I
wanted to use the macro with. I then left clicked ONE TIME thereby
highlighting the folder and then left clicked OPEN on the bottom
right.


The macro then returns an error code Run-time error '76':
Path not found

Selecting debug brings up Microsoft Visual Basic Editor and in YELLOW
highlight is the line as follows:

Set oFolder = fs.GetFolder(PathToUse)

The above line of code appears within the Public Sub section and is
the 15th actual line of code, including the 2 empty blank lines where
no code appears,

In the VBA editor, there are NO lines in RED. Only green lines which
are preceded by a ' and black lines of code. I note there are a few
empty lines where no code appears.

In an effort to eliminate a potential issue in advance, I have
carefully deleted the few empty lines and that resulted in no
difference, the same error appears.

In addition, I note there is a solid line which crosses the entire
Microsoft Visual Basic Editor editing portion of the screen and is
immediately after the line of code End Sub which appears within the
Public Sub Section, if that means anything.

Any help or suggestions will be appreciated, this project is important
and time sensitive and when done must be accurate. The original
difficulty was the inability of the macro to also do the sub folders.
Consequently, relying on long, hand written lists of folders and then
volunteers making sure they wrote the folder list properly and then
that someone ran the original macro on each and every folder. It's
like inventory checking in a huge warehouse but worse. We noted
entire folders were not included, and what's worse is when we needed
to run the same thing several times since we are in editing mode of
all these documents, its been contributing to a poor use of limited
resources and volunteers.

Thank you one and all for your help, and for your being thoughtful to
others.