View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default changing footer before save

Works fine for me.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Karthik Palaniappan" wrote in message
...
Hello Everyone,

We want to change the footer when the save event occurs. To do so, we

wrote our code in subroutine objApp_WorkbookBeforeSave . We have confirmed
that the subroutine objApp_WorkbookBeforeSave gets executed when a workbook
is saved by tracing the execution. Although, every statement in the
subroutine gets executed, the footer does not change. Can someone please
help.


Following is our code in Subroutine WorkbookBeforeSave:


Private Sub objXLApp_WorkbookBeforeSave(ByVal wbkSaveBook _
As Excel.Workbook, ByVal blnSaveAsUI As Boolean, _
Cancel As Boolean)

Dim shtSheet As Object
Dim strHeaderFooter As String


wbkSaveBook.ActiveSheet.Range("a1").Value = "india"

' Put the footer into all sheets
For Each shtSheet In wbkSaveBook.Sheets


With shtSheet.PageSetup

.LeftHeader = "LH"
.CenterHeader = "CH"
.RightHeader = "RH"
.LeftFooter = "LF"
.CenterFooter = "CF"
.RightFooter = "RF"

End With

Next shtSheet

End Sub

We are using excel 2000.

Thanks,
Karthik