S
singeredel
I am trying to open all files in a directory and then run a third-party line
count program for which I don't have access to the programming. So far I have
come up with the following code, but there are a few problems:
Sub HannaniLineCount()
Dim pFileName As String
Dim pDoc As Word.Document
Dim pFileDir As String
pFileDir = CurDir (right now this is temporary until the code works)
pFileName = Dir(pFileDir + "\*.doc")
Do Until Len(pFileName) = 0
Set pDoc = Documents.Open(pFileName)
If Left(pDoc, 12) = "HannaniNOTES" Then
GoTo NextLoop
End If
PrepareWCLineCount
pDoc.Close SaveChanges:=False
pFileName = Dir
NextLoop:
Loop
End Sub
Sub PrepareWCLineCount()
DeleteDisclosure (another sub that works fine)
ActiveWindow.View.Type = wdNormalView
Application.Run MacroName:="Abacus.Counter.AbacusCountLines"
End Sub
1. The code does not return to the calling program after calling and
executing the macro to the line count program in the sub "PrepareWCLineCount".
2. The line count program requires some keystrokes to make it work and I
don't know how to actually program in keystrokes (these would be alt+C,
alt+S, and alt+X).
3. The code does not seem to cycle to the next file in the directory.
Any help would be appreciated. I am not a programmer, so I am sure there are
things I have missed in the code. Thanks!
count program for which I don't have access to the programming. So far I have
come up with the following code, but there are a few problems:
Sub HannaniLineCount()
Dim pFileName As String
Dim pDoc As Word.Document
Dim pFileDir As String
pFileDir = CurDir (right now this is temporary until the code works)
pFileName = Dir(pFileDir + "\*.doc")
Do Until Len(pFileName) = 0
Set pDoc = Documents.Open(pFileName)
If Left(pDoc, 12) = "HannaniNOTES" Then
GoTo NextLoop
End If
PrepareWCLineCount
pDoc.Close SaveChanges:=False
pFileName = Dir
NextLoop:
Loop
End Sub
Sub PrepareWCLineCount()
DeleteDisclosure (another sub that works fine)
ActiveWindow.View.Type = wdNormalView
Application.Run MacroName:="Abacus.Counter.AbacusCountLines"
End Sub
1. The code does not return to the calling program after calling and
executing the macro to the line count program in the sub "PrepareWCLineCount".
2. The line count program requires some keystrokes to make it work and I
don't know how to actually program in keystrokes (these would be alt+C,
alt+S, and alt+X).
3. The code does not seem to cycle to the next file in the directory.
Any help would be appreciated. I am not a programmer, so I am sure there are
things I have missed in the code. Thanks!