Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello all . . .Am new to the VB part of Excel, but here is my question
as well as my code. I'm looking for some of you Gurus (MVP's) to please correct it for me, if possible. I would like to populate a cell in my Excel 2000 worksheet (cell Q119) with the last saved date, but I don't want the cell to change if the worksheet was just opened but NOT Saved! I also want to incorporate this same cell (Q119) into the header. The reason for the header is because this worksheet is printed and posted on an employee bulletin board for those employees that don't have access to the spreadsheet on a PC. The header must print on every page, letting the employees know how current the posted (printed) version is. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Range("Q119").Value = Now() End Sub Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .CenterHeader = ActiveSheet.Range("Q119").Value .RightHeader = "&8Page &P & of &N" End With End Sub One other item I would like to add to the Header would be the Operator/User that did make the last save, again if possible. I do not have that in the above code because I haven't figured out that part as of yet. Thanx to all for any help that may be provided. Jim Buege o0o_Bigs_o0o |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I can help you with filling in the last saved date in the footer.
Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = _ "&""Arial,Bold""&12 YourHeaderInfoHere " .RightHeader = "" .LeftFooter = "" .CenterFooter = "" & Chr(10) & "&P of &N" .RightFooter = _ "Last date saved: " & Format(ThisWorkbook.BuiltinDocumentProperties("las t save time").Value, "dd-mmm-yyyy") End With End Sub "o0o_Bigs_o0o" wrote: Hello all . . .Am new to the VB part of Excel, but here is my question as well as my code. I'm looking for some of you Gurus (MVP's) to please correct it for me, if possible. I would like to populate a cell in my Excel 2000 worksheet (cell Q119) with the last saved date, but I don't want the cell to change if the worksheet was just opened but NOT Saved! I also want to incorporate this same cell (Q119) into the header. The reason for the header is because this worksheet is printed and posted on an employee bulletin board for those employees that don't have access to the spreadsheet on a PC. The header must print on every page, letting the employees know how current the posted (printed) version is. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Range("Q119").Value = Now() End Sub Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .CenterHeader = ActiveSheet.Range("Q119").Value .RightHeader = "&8Page &P & of &N" End With End Sub One other item I would like to add to the Header would be the Operator/User that did make the last save, again if possible. I do not have that in the above code because I haven't figured out that part as of yet. Thanx to all for any help that may be provided. Jim Buege o0o_Bigs_o0o |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanx Barb . . .
I changed my code to match yours (with some minor cosmetic mods) BUT now my problem is that even if the sheet is just viewed (and/or printed) and NOT Saved, the "last saved time" is listing current date in the header, (not the last date the worksheet was actually saved). (The last time I saved the worksheet was 6/30/06 but the header when I viewed and printed page one shows 7/04/06) Just a thought, but, when I change the VBA code and save just the code, does this also save (and change the date) for the workbook as well? I'm sure there's some simple one-liner that needs to be added to the code, but I'm the wrong person to know the answer, hence my reason for my posts here. Thanx again Barb and to anyone else that can help me! Jim o0o_Bigs_o0o Barb Reinhardt wrote: I can help you with filling in the last saved date in the footer. Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = _ "&""Arial,Bold""&12 YourHeaderInfoHere " .RightHeader = "" .LeftFooter = "" .CenterFooter = "" & Chr(10) & "&P of &N" .RightFooter = _ "Last date saved: " & Format(ThisWorkbook.BuiltinDocumentProperties("las t save time").Value, "dd-mmm-yyyy") End With End Sub "o0o_Bigs_o0o" wrote: Hello all . . .Am new to the VB part of Excel, but here is my question as well as my code. I'm looking for some of you Gurus (MVP's) to please correct it for me, if possible. I would like to populate a cell in my Excel 2000 worksheet (cell Q119) with the last saved date, but I don't want the cell to change if the worksheet was just opened but NOT Saved! I also want to incorporate this same cell (Q119) into the header. The reason for the header is because this worksheet is printed and posted on an employee bulletin board for those employees that don't have access to the spreadsheet on a PC. The header must print on every page, letting the employees know how current the posted (printed) version is. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Range("Q119").Value = Now() End Sub Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .CenterHeader = ActiveSheet.Range("Q119").Value .RightHeader = "&8Page &P & of &N" End With End Sub One other item I would like to add to the Header would be the Operator/User that did make the last save, again if possible. I do not have that in the above code because I haven't figured out that part as of yet. Thanx to all for any help that may be provided. Jim Buege o0o_Bigs_o0o |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|