A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Including Subfolders for use within Word 2003 Macro



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old October 1st, 2004, 12:02 PM
helpserv
external usenet poster
 
Posts: n/a
Default Including Subfolders for use within Word 2003 Macro

Can someone suggest what should be modified to the macro code below,
which will permit including "sub folders" when running the following
macro within Word 2003? Thanks. By the way, the use of this macro is
for a non profit non-discriminatory youth program and your assistance
will make a difference. Thank you for your consideration.

The macro does work perfectly to add to the footer the filename and
path, print date, and page x of y and then prints the document. What
we spent the last 2 weeks trying to do is for the macro to run on
subfolders since we have many documents and many folders. We note
when running the macro as is that we have had to manually go into
every folder individually and then run the macro. Permitting
subfolders to run in addition will save a considerable amount of time
and ensure we have left no folder/ or sub folder out of our print
task. Thank you.


' onlyprint Macro
' Macro created 09/14/2004 by youth org
'

Public Sub onlyprint()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document

With Dialogs(wdDialogCopyFile)
If .Display 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With


'Close any documents that may be open
If Documents.Count 0 Then
Documents.Close Savechanges:=wdPromptToSaveChanges
End If

If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If

myFile = Dir$(PathToUse & "*.doc")

While myFile ""
Set myDoc = Documents.Open(PathToUse & myFile)
If ActiveWindow.View.SplitSpecial wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or
ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
End If
Selection.Font.Size = 7
NormalTemplate.AutoTextEntries("Filename and path").Insert Whe=
_
Selection.Range, RichText:=True
Selection.TypeText Text:=" "
NormalTemplate.AutoTextEntries("Print Date").Insert
Whe=Selection.Range _
, RichText:=True
Selection.TypeText Text:=" "
NormalTemplate.AutoTextEntries("Page X of Y").Insert
Whe=Selection. _
Range, RichText:=True

'print and close the document
myDoc.PrintOut
myDoc.Close Savechanges:=wdDoNotSaveChangesClose
myFile = Dir$()

Wend
End Sub
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF Maker Icon on Word Toolbar TimSpeak General Discussion 14 October 6th, 2004 05:31 PM
Word 2000/2002 - Proper Mail Merge steps for ODBC? Tony_VBACoder Mailmerge 7 September 2nd, 2004 09:21 PM
Word 2003 "error message" Gary W. Plourde Sr. New Users 2 August 29th, 2004 03:17 PM
Word Perfect Macros to Word 2K or 2003 RichNRockvilleMD General Discussion 2 July 22nd, 2004 05:40 PM
How to run word and pass a mail merge values and fax it to the recipient Belinda Mailmerge 2 June 13th, 2004 12:49 AM


All times are GMT +1. The time now is 10:45 AM.


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