Page Header: Setting using InputBox for LeftHeader
Option Explicit
Sub testme()
Dim myStr As String
Dim myInput As String
myStr = ActiveSheet.PageSetup.LeftHeader
myInput = InputBox(prompt:="Verify the left header", _
Title:="Header", Default:=myStr)
If Trim(myInput) = "" Then
'do nothing, don't clear the header
Else
ActiveSheet.PageSetup.LeftHeader = myInput
End If
End Sub
I don't like Sendkeys, but this worked for me, too:
Option Explicit
Sub testme()
Application.SendKeys "h%c"
Application.Dialogs(xlDialogPageSetup).Show
End Sub
GeraldM wrote:
How can I set an InputBox default value to the active worksheet's LeftHeader?
More infor - if needed:
================
I have a workbook with several worksheets.
Each sheet has the same page setup except for the LeftHeader.
Instead of using FilePageSetup on every sheet I select each sheet then run
a macro that uses an InputBox to prompt for the LeftHeader and reset it.
This works OK except the InputBox value is initially <blank
What I would really like to do is to set the InputBox default value to the
existing LeftHeader value. This way I don't have to re-type the header in
full when, for example, I only want to correct a spelling mistake.
--
Dave Peterson
|