Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Please ammend or adivise re this easy print rountine

I'm fairly new to writing macros (only used JAVA before not VB). Please help


I want to write a macro to print all worksheets (first page for each only)
in a workbook

with the exception of worksheets called "import" and "client details".


I have made the following guess of how it should be written.

Please advise where I've gone wrong.
I don't know how to refer to the end of all worksheets in range or
how to refer to a worksheet name (guessed with application.name)

Many many thanks in anticipation

James


Sub Printing()
'
' Printing Macro


For i = 1 To ??end of all worksheets??

Sheets(i).Select

If (ActiveWindow.SelectedSheets.Application.Name = "import") Or
(ActiveWindow.SelectedSheets.Application.Name = "client details") Then
' do nothing
Else
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1,
Copies:=1, Collate:=True
End If

Next i

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Please ammend or adivise re this easy print rountine

Try this James

Sub Printing()
Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets

If sh.Name = "import" Or sh.Name = "client details" Then
' do nothing
Else
sh.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
End If

Next sh

End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl



"James Cornthwaite" wrote in message ...
I'm fairly new to writing macros (only used JAVA before not VB). Please help


I want to write a macro to print all worksheets (first page for each only) in a workbook

with the exception of worksheets called "import" and "client details".


I have made the following guess of how it should be written.

Please advise where I've gone wrong.
I don't know how to refer to the end of all worksheets in range or
how to refer to a worksheet name (guessed with application.name)

Many many thanks in anticipation

James


Sub Printing()
'
' Printing Macro


For i = 1 To ??end of all worksheets??

Sheets(i).Select

If (ActiveWindow.SelectedSheets.Application.Name = "import") Or (ActiveWindow.SelectedSheets.Application.Name = "client
details") Then
' do nothing
Else
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
End If

Next i

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Please ammend or adivise re this easy print rountine

brilliant, thanks !


"Ron de Bruin" wrote in message
...
Try this James

Sub Printing()
Dim sh As Worksheet

For Each sh In ActiveWorkbook.Worksheets

If sh.Name = "import" Or sh.Name = "client details" Then
' do nothing
Else
sh.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
End If

Next sh

End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl



"James Cornthwaite" wrote in message
...
I'm fairly new to writing macros (only used JAVA before not VB). Please
help


I want to write a macro to print all worksheets (first page for each
only) in a workbook

with the exception of worksheets called "import" and "client details".


I have made the following guess of how it should be written.

Please advise where I've gone wrong.
I don't know how to refer to the end of all worksheets in range or
how to refer to a worksheet name (guessed with application.name)

Many many thanks in anticipation

James


Sub Printing()
'
' Printing Macro


For i = 1 To ??end of all worksheets??

Sheets(i).Select

If (ActiveWindow.SelectedSheets.Application.Name = "import")
Or (ActiveWindow.SelectedSheets.Application.Name = "client details") Then
' do nothing
Else
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1,
Copies:=1, Collate:=True
End If

Next i

End Sub





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
There must be an easy way? kassie Excel Discussion (Misc queries) 5 May 26th 07 06:33 AM
need to ammend a formula Robb27 Excel Worksheet Functions 2 August 5th 06 08:04 AM
Add comments via a function - please could you ammend my code/ pseudocode to work James Cornthwaite Excel Programming 6 June 7th 06 11:43 PM
Easy Print macro needed funkymonkUK[_42_] Excel Programming 7 June 30th 05 03:44 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM


All times are GMT +1. The time now is 02:00 AM.

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"