#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Print

I need to create a macro to print the active page. Can anyone help me with
the codes Please?
--
thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Print

Try

ActiveSheet.PrintOut



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ernie" wrote in message
...
I need to create a macro to print the active page. Can anyone
help me with
the codes Please?
--
thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Print

Ok i tried it, but it prints out all the pages in the worksheet. i only want
to print out the active 'PAGE'. I would also like the codes to specify pages
and number of copies to print out.
--
help a friend help you


"Chip Pearson" wrote:

Try

ActiveSheet.PrintOut



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ernie" wrote in message
...
I need to create a macro to print the active page. Can anyone
help me with
the codes Please?
--
thanks in advance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Print

Here is something Dana Delouis posted some time ago:

Sub Print_Page_of_ActiveCell()
'// Prints the page of the active cell only
'// Dana DeLouis:
'// Not tested completely for Excel 2k


Dim pb As Variant
Dim Nr As Long, Nc As Integer
Dim MaxColumns As Long
Dim MaxRows As Long
Dim CurrentPage As Long
Dim TotalPages As Long


If Selection.Cells.Count 1 Then
MsgBox "Select 1 Cell Only"
Exit Sub
End If


'// Save Settings
ActiveWorkbook.CustomViews.Add _
ViewName:="_temp", _
PrintSettings:=True, _
RowColSettings:=True


With ActiveSheet.PageSetup
.PrintArea = False
.Order = xlOverThenDown
End With


TotalPages = ExecuteExcel4Macro("Get.Document(50)")
MaxColumns = ActiveSheet.VPageBreaks.Count + 1
MaxRows = ActiveSheet.HPageBreaks.Count + 1
' or MaxRows = TotalPages / MaxColumns


For Each pb In ActiveSheet.HPageBreaks
If pb.Location.Row <= ActiveCell.Row Then
Nr = Nr + 1
Else
Exit For
End If
Next


For Each pb In ActiveSheet.VPageBreaks
If pb.Location.Column <= ActiveCell.Column Then
Nc = Nc + 1
Else
Exit For
End If
Next


Nc = Nc + 1
CurrentPage = Nr * MaxColumns + Nc


'// Reset what I had
With ActiveWorkbook.CustomViews("_temp")
.Show
.Delete
End With


'MsgBox "Page : " & CurrentPage & " out of " & TotalPages


// Print the selected page
ActiveSheet.PrintOut From:=CurrentPage, To:=CurrentPage, _
Copies:=1
End Sub

--
Regards,
Tom Ogilvy


"ernie" wrote:

Ok i tried it, but it prints out all the pages in the worksheet. i only want
to print out the active 'PAGE'. I would also like the codes to specify pages
and number of copies to print out.
--
help a friend help you


"Chip Pearson" wrote:

Try

ActiveSheet.PrintOut



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ernie" wrote in message
...
I need to create a macro to print the active page. Can anyone
help me with
the codes Please?
--
thanks in advance




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
Print and Print Preview Graphic Moving Resizing 2007/2003 Adam Rayburn Excel Discussion (Misc queries) 0 April 4th 07 04:18 PM
cell borders that I create dont show on print preview or print scott3435 Excel Discussion (Misc queries) 2 April 6th 06 02:37 AM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Active cell counting in particular print page (one sheet having different print area) ananthmca2004 Excel Worksheet Functions 1 November 24th 05 11:29 AM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM


All times are GMT +1. The time now is 05:27 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"