Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the footer it allows me to incorportate the real time:-
&[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dermot
Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Joergen for your reply,
Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dermot
A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joergen,
Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dermot.
You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joergen
Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested The "&12" and "&6" were displayed in the footer as text! My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub AABB()
Sheet1.PageSetup.CenterFooter = Format(Now, _ "DD/MM/YYYY HH:MM:SS") & _ " - Requested by MASTER - Page 1" Sheet1.PrintPreview End Sub works fine for me. -- Regards, Tom Ogilvy "Dermot" wrote in message ... Hi Joergen Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested The "&12" and "&6" were displayed in the footer as text! My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom
Thanks for that, I have made a hard job of it!!! DD/MM/YY I never though of the obvious. I was trying &[Date] like it's used within the Footer dialogue. Can you explain what the difference is as &[Date] didn't work Thanks again Dermot "Tom Ogilvy" wrote: Sub AABB() Sheet1.PageSetup.CenterFooter = Format(Now, _ "DD/MM/YYYY HH:MM:SS") & _ " - Requested by MASTER - Page 1" Sheet1.PrintPreview End Sub works fine for me. -- Regards, Tom Ogilvy "Dermot" wrote in message ... Hi Joergen Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested The "&12" and "&6" were displayed in the footer as text! My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can see if you want to use the build in attribute, you can turn on the
macro recorder and set up the footer. Then turn off the macro recorder. I wanted to put in a footer of Page 1 of 10 Pages as an example. I recorded this ..CenterHeader = "Page &P of &N Pages" so you can see in the actual CenterHeader string, the equivalend of &[Page] is &P an for &[Pages], it produces &N. If I go to the VBE and in a module type in CenterHeader and highlight it (or highlight an existing entry in your code and hit F1, in the help I see a link to "Format Codes" This link shows: &L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &O Turns outline printing on or off (Macintosh only). &H Turns shadow printing on or off (Macintosh only). &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P +number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. As you know, you don't have any control over the format of the data or time. So as long as you are going to write code to hard code that value in your footer string and you are using Now (which gives the date and time), it just seemed logical to expand the format to show the date as well. One difference is that &D will always show the date when you print. The hard coded date your code enters will only change when you run your code. A lot of people put such code in the BeforePrint Event in the ThisWorkbook module. -- Regards, Tom Ogilvy "Dermot" wrote in message ... Hi Tom Thanks for that, I have made a hard job of it!!! DD/MM/YY I never though of the obvious. I was trying &[Date] like it's used within the Footer dialogue. Can you explain what the difference is as &[Date] didn't work Thanks again Dermot "Tom Ogilvy" wrote: Sub AABB() Sheet1.PageSetup.CenterFooter = Format(Now, _ "DD/MM/YYYY HH:MM:SS") & _ " - Requested by MASTER - Page 1" Sheet1.PrintPreview End Sub works fine for me. -- Regards, Tom Ogilvy "Dermot" wrote in message ... Hi Joergen Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested The "&12" and "&6" were displayed in the footer as text! My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom
Thanks for this I will try it out. Kind Regards Dermot "Tom Ogilvy" wrote: You can see if you want to use the build in attribute, you can turn on the macro recorder and set up the footer. Then turn off the macro recorder. I wanted to put in a footer of Page 1 of 10 Pages as an example. I recorded this ..CenterHeader = "Page &P of &N Pages" so you can see in the actual CenterHeader string, the equivalend of &[Page] is &P an for &[Pages], it produces &N. If I go to the VBE and in a module type in CenterHeader and highlight it (or highlight an existing entry in your code and hit F1, in the help I see a link to "Format Codes" This link shows: &L Left aligns the characters that follow. &C Centers the characters that follow. &R Right aligns the characters that follow. &E Turns double-underline printing on or off. &X Turns superscript printing on or off. &Y Turns subscript printing on or off. &B Turns bold printing on or off. &I Turns italic printing on or off. &U Turns underline printing on or off. &S Turns strikethrough printing on or off. &O Turns outline printing on or off (Macintosh only). &H Turns shadow printing on or off (Macintosh only). &D Prints the current date. &T Prints the current time. &F Prints the name of the document. &A Prints the name of the workbook tab. &P Prints the page number. &P +number Prints the page number plus the specified number. &P-number Prints the page number minus the specified number. && Prints a single ampersand. & "fontname" Prints the characters that follow in the specified font. Be sure to include the double quotation marks. &nn Prints the characters that follow in the specified font size. Use a two-digit number to specify a size in points. &N Prints the total number of pages in the document. As you know, you don't have any control over the format of the data or time. So as long as you are going to write code to hard code that value in your footer string and you are using Now (which gives the date and time), it just seemed logical to expand the format to show the date as well. One difference is that &D will always show the date when you print. The hard coded date your code enters will only change when you run your code. A lot of people put such code in the BeforePrint Event in the ThisWorkbook module. -- Regards, Tom Ogilvy "Dermot" wrote in message ... Hi Tom Thanks for that, I have made a hard job of it!!! DD/MM/YY I never though of the obvious. I was trying &[Date] like it's used within the Footer dialogue. Can you explain what the difference is as &[Date] didn't work Thanks again Dermot "Tom Ogilvy" wrote: Sub AABB() Sheet1.PageSetup.CenterFooter = Format(Now, _ "DD/MM/YYYY HH:MM:SS") & _ " - Requested by MASTER - Page 1" Sheet1.PrintPreview End Sub works fine for me. -- Regards, Tom Ogilvy "Dermot" wrote in message ... Hi Joergen Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested The "&12" and "&6" were displayed in the footer as text! My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dermot
I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested &12 and &6 was the size for Time and the trailing String. The "&12" and "&6" were displayed in the footer as text! Odd. Remove it. If you do not need Now formated, you can use below Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) Sheet1.PageSetup.CenterFooter = _ Now & " - Requested by MASTER - Page 1" End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dermot
I have send this answer to you once, but it do not appear in NG. Therefore I try again. I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested &12 and &6 was the size for Time and the trailing String. The "&12" and "&6" were displayed in the footer as text! Odd. Remove it. If you do not need Now formated, you can use below Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) Sheet1.PageSetup.CenterFooter = _ Now & " - Requested by MASTER - Page 1" End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen Thanks for posting again. Using most of the code you gave me resolved my problem. To get it to display seconds for me I changed it as follows: Sheet1.PageSetup.CenterFooter = "" & Format(Now, "HH:MM:SS") & _ " - Requested by MASTER - Page 1" I am not sure about these two parts of the code you used....... 1. CenterFooter = "&12 " 2. & "&6 - Requested The "&12" and "&6" were displayed in the footer as text! My problem now..... I have been trying to incorporate the date at the beginning like this: 27/08/2006 20:35:15 - Requested by MASTER - Page 1 I have had no success with the date, all I have been getting are syntax errors with any code I try. Could you give me a little more help. I am using UK time too, as I am in the UK. Thanks for the other time formats that good to know. Best wishes Dermot "Joergen Bondesen" wrote: Hi Dermot. You are welcome. I am using Excel UK (and not Danish) in Denmark. Therefor try these 2 posibilities, please. What aboute Regional Settings in Windows? Have a look there, please. Try replace "HH:MM:SS" with below '// Perhaps International Format(Now, "Long Time") '// Lowercase mm:ss Format(Now, "HH:mm:ss") -- Best regards Joergen Bondesen "Dermot" wrote in message ... Hi Joergen, Thanks once more for yet another reply. I have used the macro recorder on some occassions and copied and pasted the code. The only thin is, the recorder does not alway record everything you do which I found to be the case here. The recorder also records everything and I thin have to try and determine what is required and discard the other parts if you know what I mean. I find the code you supplied works fine, but for some reason the seconds do not show in the centre footer......18:48......rather than 18:48:35 although you have included seconds in the code......could it be something to do with the way MS have coded the centre footer? Strage don't you think? Have you any other suggestions. Kind Regards Dermot "Joergen Bondesen" wrote: Hi Dermot A1. You can Record a macro where you are doing something in footer. Then you can cut from macro. Option Explicit '// Change size (&*) to your purpose Private Sub Workbook_BeforePrint(Cancel As Boolean) '// ATT.: Now Sheet1 and NOT Activesheet Sheet1.PageSetup.CenterFooter = "&12 " _ & Format(Now, "HH:MM:SS") _ & "&6 - Requested by MASTER - Page 1" End Sub A2. If I choose Preview I'm in trouble. Save before testing. 8-) Private Sub CommandButton1_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... Thanks Joergen for your reply, Can you advise a little further please........... Q1. That works fine in the left footer, how do I incorportate it into the Centre footer which would look like this................ Real Time- Requested by MASTER - Page 1 "Requested Master" is text "Page 1" is Text Q2. When I click on the print preview command button on UserForm1 I do not see the real time in the left footer. Although if I go to the worksheet File | Print Preview the Real time does show in the left footer. The code I am using for print preview and print command buttons on UserFrom1 are as follows..... Private Sub cmdPrintPreview_Click() Sheet1.PageSetup.PrintArea = "A1:U13" UserForm1.Hide Application.Dialogs(xlDialogPrintPreview).Show UserForm1.Show End Sub and................. Private Sub cmdPrint_Click() Sheet1.PageSetup.PrintArea = "A1:U13" Application.Dialogs(xlDialogPrint).Show End Sub "Joergen Bondesen" wrote: Hi Dermot Try this, please. Plased in Thisworkbook Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.LeftFooter = Format(Now, "HH:MM:SS") End Sub -- Best regards Joergen Bondesen "Dermot" wrote in message ... In the footer it allows me to incorportate the real time:- &[Date]&[Time] this returns an Hours and Minutes format.....10:30 How do I modify it to include seconds too....Hours, Minutes and seconds....10:30:45 Thanks Dermot |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Add Seconds to Date - Time Field | Excel Worksheet Functions | |||
Format time to not include seconds and AM/PM | New Users to Excel | |||
How to convert date/time to seconds | Excel Worksheet Functions | |||
Need help: convert seconds to date and time | Excel Discussion (Misc queries) | |||
The shortcut to enter time in excel should include seconds. | Excel Discussion (Misc queries) |