ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrieve Center Header String (https://www.excelbanter.com/excel-programming/417713-retrieve-center-header-string.html)

Ken Hudson

Retrieve Center Header String
 
As part of a macro I am opening an existing workbook. That WB has a center
header in the print set up. How can I pull that center header string into the
macro and assign it to a variable?

Dim SHeader as String
Sub GetHeader
Workbooks.Open "Test.xls"
sHeader= what?
...........
........
End Sub
--
Ken Hudson

Rick Rothstein

Retrieve Center Header String
 
Assign the PageSetup.CenterHeader property for the worksheet to your
variable.

--
Rick (MVP - Excel)


"Ken Hudson" wrote in message
...
As part of a macro I am opening an existing workbook. That WB has a center
header in the print set up. How can I pull that center header string into
the
macro and assign it to a variable?

Dim SHeader as String
Sub GetHeader
Workbooks.Open "Test.xls"
sHeader= what?
...........
........
End Sub
--
Ken Hudson



Ken Hudson

Retrieve Center Header String
 
I can't get the code right to do this.

sHeader=PageSetup.CenterHeader

doesn't work?
--
Ken Hudson


"Rick Rothstein" wrote:

Assign the PageSetup.CenterHeader property for the worksheet to your
variable.

--
Rick (MVP - Excel)


"Ken Hudson" wrote in message
...
As part of a macro I am opening an existing workbook. That WB has a center
header in the print set up. How can I pull that center header string into
the
macro and assign it to a variable?

Dim SHeader as String
Sub GetHeader
Workbooks.Open "Test.xls"
sHeader= what?
...........
........
End Sub
--
Ken Hudson




Ken Hudson

Retrieve Center Header String
 
orry Rick, I got it. I needed:

sHeader=ActiveSheet.PageSeetup.CenterHeader

My apologies.
--
Ken Hudson


"Rick Rothstein" wrote:

Assign the PageSetup.CenterHeader property for the worksheet to your
variable.

--
Rick (MVP - Excel)


"Ken Hudson" wrote in message
...
As part of a macro I am opening an existing workbook. That WB has a center
header in the print set up. How can I pull that center header string into
the
macro and assign it to a variable?

Dim SHeader as String
Sub GetHeader
Workbooks.Open "Test.xls"
sHeader= what?
...........
........
End Sub
--
Ken Hudson





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com