Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro for Custom Header

Hello,

I am trying to create a macro button to help me automatically do the
following tasks:

-Change Sheet
-View
-Header and Footer
-Custom Header

When I try to record the macro, it won't let me stop the macro with a
dialog box open.

The custom header will change every time the file is opened.

Any ideas?

Any help is greatly appreciated!

Matt St.Onge
Drafting & Estimating Manager
Mankato Kasota Stone
www.mankatokasotastone.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Macro for Custom Header

Do you just want to show the pagesetup dialog box?

Application.Dialogs(xlDialogPageSetup).Show

" wrote:

Hello,

I am trying to create a macro button to help me automatically do the
following tasks:

-Change Sheet
-View
-Header and Footer
-Custom Header

When I try to record the macro, it won't let me stop the macro with a
dialog box open.

The custom header will change every time the file is opened.

Any ideas?

Any help is greatly appreciated!

Matt St.Onge
Drafting & Estimating Manager
Mankato Kasota Stone
www.mankatokasotastone.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro for Custom Header

Great! Yes. Is it possible to take it a couple steps further?

i.e...

-Header/Footer Tab
-Custom Header...

Thanks.

Matt St.Onge
Drafting & Estimating Manager
Mankato Kasota Stone
www.mankatokasotastone.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro for Custom Header

More...

When the pagesetup dialog box comes up, you can literally hit "H" on
the keyboard and "<AltC" to get there after that. However, I am not
aware of how to program literal key strokes into VBA.

I am assuming that is all I would need to do?

Thanks again.

Matt St.Onge
Drafting & Estimating Manager
Mankato Kasota Stone
www.mankatokasotastone.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Macro for Custom Header

SendKeys can perform literal keystrokes.

Application.SendKeys "H" & "%(C)"
Application.Dialogs(xlDialogPageSetup).Show

After you confirm the custom header, click OK and return to the main
pagesetup form - it may not show the header you just entered. Just click OK.


Alternatively, you could get the user to input the header via an inputbox,
then have VBA set the custom header

x = Application.InputBox("Enter Header")
Sheets("Sheet1").PageSetup.LeftHeader = x

If you search VBA's help for headers, you should be able to find formatting
codes for font, font size, italics, bold, etc.


" wrote:

More...

When the pagesetup dialog box comes up, you can literally hit "H" on
the keyboard and "<AltC" to get there after that. However, I am not
aware of how to program literal key strokes into VBA.

I am assuming that is all I would need to do?

Thanks again.

Matt St.Onge
Drafting & Estimating Manager
Mankato Kasota Stone
www.mankatokasotastone.com




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
Macro to create a custom header/footer... jgbadingerjr Excel Discussion (Misc queries) 0 March 13th 07 12:27 AM
Macro for Custom Header Le Jurassien Excel Discussion (Misc queries) 1 January 22nd 07 06:27 PM
Custom Header Macro Le Jurassien Excel Discussion (Misc queries) 1 January 10th 07 11:16 PM
Excel: custom header - is it possible to paste into header? Maureen D. Excel Worksheet Functions 0 November 4th 05 03:07 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM


All times are GMT +1. The time now is 06:36 PM.

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

About Us

"It's about Microsoft Excel"