|
-
Aug 1st, 2006, 08:34 AM
#1
Thread Starter
Junior Member
FOoter Looping Program
I have the following Code: and I am getting a Select Case Compilation error that I can't figure out.. I tried adding an "End Select" for my second case.... etc.
Sub MacroUpdateFooter()
'
' MacroUpdateFooter Macro
' Macro recorded 7/28/2006 by Blue2man
'
Dim tmp As String
Dim ext As String
Dim XLS As Variant
Dim sPath As String
sPath = "c:\baseline\"
tmp = Dir(sPath & "*.*")
Do While tmp > ""
ext = LCase(Right(tmp, 3))
Select Case ext
Case "xls"
Set XLS = New Application
Set oBook = XLS.Workbooks.Open(sPath & tmp)
For Each oSheet In oBook.Worksheets
With oSheet.PageSetup
.PrintArea = ""
.LeftFooter = "&D"
.CenterFooter = "&Z&F"
.RightFooter = "&P"
End With
Next oSheet
oBook.Save
Set oBook = Nothing
XLS.Quit
Set XLS = Nothing
Select Case WRD
Case "doc"
Set DOC = New Application
WRD.Documents.Open sPath & tmp
With Documents.PageSetup
.Print Area = ""
.LeftFooter = "&Z&F"
'WRD.ActiveDocument.Save
'RD.Quit
'Set WRD = Nothing
'Case "ppt"
' Case "???" ' visio
End Select
tmp = Dir
Loop
MsgBox "Job Complete"
End Sub
Now When compiling.. VB highlights ENd Select (4th to last line)
and says its an End Select without a Select Case...
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|