WordBasic.SortArray FileArray



Hello group
I have a macro I use to open word docs in batches. I need them to open up
sorted by name. The directory they are coming from is sorted by name - makes
for easy sync if they open in word the same way. This macro I am posting
used to do the sorting for me and I got everything nicely alpabetized. But
right now it isn't working for me - the files are coming in some random
order that is very inconvenient to my purposes.
Can anyone spot what the problem is and point it out to me please.
I am running MSWord 2003 SP3 on XP Pro SP3 on Dell OptiPlex GX270
Thanks for your help in advance
Joanne


Public Sub GetFiles()
' GetFiles Macro
' Macro recorded 06/23/00 by Joanne
'
'Application.CommandBars("Main Menu").Visible = False
Dim Resumes As String, FileArray() As String, Num As Long, OpnFile As Long
Dim PassNum As Integer, temp As String 'sorting variables
Dim Upper As Long 'Upper boundary of array
ReDim FileArray(700)
Num = 0 'Setting counter to 0
OpnFile = 0 'Setting counter to 0

Resumes = Dir$("C:\Resumes-ToDo\todo\*.*") 'Where the files are at
Do While Len(Resumes) > 0 ' Loop to put files into an array
FileArray(Num) = Resumes
Num = Num + 1
Resumes = Dir$
Loop
ReDim Preserve FileArray(Num - 1)
Upper = UBound(FileArray)

' Sort array
WordBasic.SortArray FileArray


' Open the files for editing
For OpnFile = 0 To 19
If OpnFile <= Upper Then 'if there are files in the array
Documents.Open FileName:="C:\Resumes-ToDo\todo\" _
& FileArray(OpnFile) 'then open the next one and increment counter
' Application.ShowWindowsInTaskbar = True
'Application.WindowState = wdWindowStateNormal
ActiveWindow.ActivePane.View.Zoom.Percentage = 118

End If
If OpnFile = -1 Then
Application.Quit
End If
Next

End Sub


.



Relevant Pages

  • Re: Cascading Windows
    ... Dim Resumes As String, FileArrayAs String, Num As Long, OpnFile As ... Dim Upper As Long 'Upper boundary of array ... Do While Len> 0 ' Loop to put files into an array ... and allowing me to use the bottom 50% for the other 2 apps). ...
    (microsoft.public.word.customization.menustoolbars)
  • Cascading Windows
    ... Dim Resumes As String, FileArrayAs String, Num As Long, OpnFile As ... Dim Upper As Long 'Upper boundary of array ... Do While Len> 0 ' Loop to put files into an array ... and allowing me to use the bottom 50% for the other 2 apps). ...
    (microsoft.public.word.customization.menustoolbars)
  • application.quit
    ... I have a little sub routine to put files from a specific folder into an ... array, then open and process them 14 files at a time. ... OpnFile is the counter for the for the open files and when I have done all ... Dim Upper As Long 'Upper boundary of array ...
    (microsoft.public.word.vba.beginners)
  • Array and Struct Constants in MASM
    ... compile-time array and structure constants. ... Syntax (used as a macro function): ... This macro creates a MASM struct declaration and also creates ...
    (alt.lang.asm)
  • Re: Help end the testing tedium please
    ... The new macro is crashing at: ... The filename and sheet name look fine. ... two arguments needed for "Consolidate". ... the file really were test1 thru test60, would the array statement need ...
    (microsoft.public.excel.programming)

Loading