Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Visual Basic Question

I have several worksheets that I need to inset the page
number into the center footer. I would use the &page
number but my page numbers are in the format of "1-1, 1-2,
1-3, etc." Excel does not allow this so I am trying to
write a macro that asks me the page number and inserts it
into the center footer position. I have that part of the
macro written but I cannot format the font, size and
boldness of the page number. Can anyone give me a hand.
Here is the macro I have currently tried and I want it to
appear Arial Font size 4, and Bolded.


Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox("Enter
page Number")

End Sub

Any ideas or suggestions would be greatly appreciated.
Thanks in adance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Visual Basic Question

Craig;

Here ya go;

Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox
("Enterpage Number")
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Bold""&11 44"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub





-----Original Message-----
I have several worksheets that I need to inset the page
number into the center footer. I would use the &page
number but my page numbers are in the format of "1-1, 1-

2,
1-3, etc." Excel does not allow this so I am trying to
write a macro that asks me the page number and inserts it
into the center footer position. I have that part of the
macro written but I cannot format the font, size and
boldness of the page number. Can anyone give me a hand.
Here is the macro I have currently tried and I want it to
appear Arial Font size 4, and Bolded.


Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox("Enter
page Number")

End Sub

Any ideas or suggestions would be greatly appreciated.
Thanks in adance.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Visual Basic Question

I tried this but I enter the page number and the page
number stays at 44. Which appears in .CenterFooter
= "&""Arial Black,Bold""&11 44" of your formula.

I am wondering if there is even a way to get this to work
with the InputBox feature. I have tried to use the
InputBox function where the "44" appears but cannot get it
to work.

Thanks for your help!!






-----Original Message-----
Craig;

Here ya go;

Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox
("Enterpage Number")
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Bold""&11 44"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub





-----Original Message-----
I have several worksheets that I need to inset the page
number into the center footer. I would use the &page
number but my page numbers are in the format of "1-1, 1-

2,
1-3, etc." Excel does not allow this so I am trying to
write a macro that asks me the page number and inserts

it
into the center footer position. I have that part of

the
macro written but I cannot format the font, size and
boldness of the page number. Can anyone give me a

hand.
Here is the macro I have currently tried and I want it

to
appear Arial Font size 4, and Bolded.


Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox("Enter
page Number")

End Sub

Any ideas or suggestions would be greatly appreciated.
Thanks in adance.
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Visual Basic Question

Sub PromptForFooter()

Dim strFooter As String

strFooter = InputBox("Enter Page Number:")
With ActiveSheet.PageSetup
.CenterFooter = "&""Arial,Bold""&4 " & strFooter
End With
End Sub

You did say you wanted Arial, Bold, 4 point, right?

If not, change the 4 but be *sure* to leave a space between it and the
closing quote or VBA will take the first part of your page number and treat
it as part of the Font size. When I ran this code without the space, a Font
size of 11 and strFooter equal to "2-1" I got a font size of 112 and a
Footer of "-1" in PrintPreview. An interesting result, but not what you
want. :-) This wouldn't be an issue if the value of strFooter began with a
non-numeric value.

Hope this helps,
--
George Nicholson

Remove 'Junk' from return address.


"Craig" wrote in message
...
I tried this but I enter the page number and the page
number stays at 44. Which appears in .CenterFooter
= "&""Arial Black,Bold""&11 44" of your formula.

I am wondering if there is even a way to get this to work
with the InputBox feature. I have tried to use the
InputBox function where the "44" appears but cannot get it
to work.

Thanks for your help!!






-----Original Message-----
Craig;

Here ya go;

Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox
("Enterpage Number")
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Bold""&11 44"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub





-----Original Message-----
I have several worksheets that I need to inset the page
number into the center footer. I would use the &page
number but my page numbers are in the format of "1-1, 1-

2,
1-3, etc." Excel does not allow this so I am trying to
write a macro that asks me the page number and inserts

it
into the center footer position. I have that part of

the
macro written but I cannot format the font, size and
boldness of the page number. Can anyone give me a

hand.
Here is the macro I have currently tried and I want it

to
appear Arial Font size 4, and Bolded.


Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox("Enter
page Number")

End Sub

Any ideas or suggestions would be greatly appreciated.
Thanks in adance.
.

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Thanks George

George:

Thanks a ton. This works great!



-----Original Message-----
Sub PromptForFooter()

Dim strFooter As String

strFooter = InputBox("Enter Page Number:")
With ActiveSheet.PageSetup
.CenterFooter = "&""Arial,Bold""&4 " & strFooter
End With
End Sub

You did say you wanted Arial, Bold, 4 point, right?

If not, change the 4 but be *sure* to leave a space

between it and the
closing quote or VBA will take the first part of your

page number and treat
it as part of the Font size. When I ran this code

without the space, a Font
size of 11 and strFooter equal to "2-1" I got a font size

of 112 and a
Footer of "-1" in PrintPreview. An interesting result,

but not what you
want. :-) This wouldn't be an issue if the value of

strFooter began with a
non-numeric value.

Hope this helps,
--
George Nicholson

Remove 'Junk' from return address.


"Craig" wrote in

message
...
I tried this but I enter the page number and the page
number stays at 44. Which appears in .CenterFooter
= "&""Arial Black,Bold""&11 44" of your formula.

I am wondering if there is even a way to get this to

work
with the InputBox feature. I have tried to use the
InputBox function where the "44" appears but cannot get

it
to work.

Thanks for your help!!






-----Original Message-----
Craig;

Here ya go;

Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox
("Enterpage Number")
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Bold""&11 44"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub





-----Original Message-----
I have several worksheets that I need to inset the

page
number into the center footer. I would use the &page
number but my page numbers are in the format of "1-1,

1-
2,
1-3, etc." Excel does not allow this so I am trying

to
write a macro that asks me the page number and inserts

it
into the center footer position. I have that part of

the
macro written but I cannot format the font, size and
boldness of the page number. Can anyone give me a

hand.
Here is the macro I have currently tried and I want it

to
appear Arial Font size 4, and Bolded.


Sub PageNumber()
ActiveSheet.PageSetup.CenterFooter = InputBox

("Enter
page Number")

End Sub

Any ideas or suggestions would be greatly appreciated.
Thanks in adance.
.

.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual basic 6.5 question using combo box and call procedure. TAS Excel Discussion (Misc queries) 7 April 15th 09 06:46 PM
Visual Basic Question ALEX Excel Worksheet Functions 3 February 6th 07 11:46 AM
visual basic coding question stevie888 Excel Discussion (Misc queries) 0 November 26th 06 10:24 PM
Visual Basic Question Peter W Soady \(UK\) Excel Discussion (Misc queries) 1 October 25th 06 06:26 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM


All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"