Printer Set Up in VBA

  • Thread starter Thread starter PostalVote
  • Start date Start date
P

PostalVote

Hi

I am rather new to this so any advice is greatly appreciated.

I am trying to set up a macro which creates a sheet for the user based
on their input. My main stumbling block is entering the required text
as a header in the print-page set up.

I would like to be able to take a string of text from a cell reference
and use it ( or part of it) as a title for the document.

I have been working on this for without success for sometime now.

Thanks in advance
Mike :confused:
 
Hi PostalVote

Try this

It will add a sheet to your workbook
And use cell A1 if the activesheet in the footer (or header)

Sub test()
Dim Aws As Worksheet
Dim Nws As Worksheet

Set Aws = ActiveSheet
Set Nws = Worksheets.Add

With Nws
.PageSetup.LeftFooter = Aws.Range("a1").Value
End With
End Sub
 
Try this, it takes all of name from cell reference C5 and puts it t
centerheader.



Sub Macro1()

Dim TitleOfDocument As String

'set variable titleofdocument to be value of cell C5
TitleOfDocument = Cells(5, 3).Value
'
With ActiveSheet.PageSetup
.CenterHeader = TitleOfDocument
End With
End Su
 
Worked an absolute treat, exactly what I was looking for.

Many thanks
Mik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top