View Single Post
  #7  
Old October 5th, 2004, 01:33 AM
helpserv
external usenet poster
 
Posts: n/a
Default

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.









Jay Freedman wrote in message . ..
Answers, in order of your questions, with more questions:

- When you say the code doesn't appear to work, exactly what are the
symptoms? Do you get an error message, or do you get wrong footers or
no footers in the documents, or does it seem that the macro doesn't
run at all? Exactly how are you trying to run the macro?

- Yes, the three references you list should be sufficient. The macro
runs on my system -- which is also Word 2003 on Windows XP Pro -- with
only those references selected.

- When the macro runs, it should open the Copy dialog; you should be
able to navigate to the topmost folder of the group you want to work
on and click OK, and that path is returned to the macro. This part of
the macro is exactly the same as the one you posted, which you said
was working except for not doing subfolders.

- If you get an error message about a syntax error, I suspect you
might be having trouble with extra line breaks introduced into the
code by the newsgroup posting mechanism. In the VBA editor, are there
any lines in red? If so, which ones?

- Yes, the o in oFolder is deliberate. It's a bad idea to name
variables the same as data types or other keywords of the VBA
language, which can lead to confusion. The o (which stands for object)
distinguishes the variable oFolder from the data type Folder. This is
based on a system called "Hungarian notation" (invented by Charles
Simonyi), which you can read about at
http://msdn.microsoft.com/library/te...hunganotat.htm.

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

(helpserv) wrote:

Hi Jay, and all the others out there willing to help others:

Installed the code as provided, after making the required selection of
the Microsoft Scripting Runtime-- however the code does not appear to
work (most likely something we are unaware of how to do).

We note the following References are selected: Visual Basic for
Applications, Microsoft Word 11.0 Object Library and Microsoft
Scripting Runtime are the only 3 References selected. Are they the
only ones necessary for this code to work properly? Are they the
correct references?

We are using Word 2003, as part of Office 2003 on a Windows XP
Professional operating system.

There is an issue with the process of the path and how the file
folders are selected. Are we supposed to enter manually into the
code, the path? Or are we supposed to be seeing a window of some kind
where we make the actual selection.

We pasted the code as offered into notepad and then copied it into the
Macro editor. Are there any modifications of any kind supposed to be
entered into the code by us? Or are we supposed to be able to use the
code as written exactly?

By the way, there appears in the code suggested, places where there
are o's in what otherwise wouldn't spell a word. For example see the
second line to follow where the word folder is preceded by the o:
Public Sub OnlyPrint()
Dim fs As FileSystemObject, oFolder As Folder
Dim PathToUse As String

Is the o that appears periodically throughout the code supposed to be
there?


Thank you for your consideration. Please be aware this macro is for
use by a non profit youth program that does not discriminate in its
membership and no one is turned away if they can not afford
membership. Your assistance is appreciated and profoundly makes a
difference.