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

This may be way simple, but could use some help starting. I want to be
able to select a number of excel files from a menu list and then perfom
a simple macro in every worksheet in each of those files. These steps

- select files for batch
- Loopt through files
- Loop through worksheets in each file
- run a simple macro sequence (Clear Print Area)

thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default utility

Hi hurdler,

Something like this should work:

Sub ClearPrintAreaForWBs()
Dim vFiles As Variant
Dim fil As Variant
Dim wb As Workbook
Dim ws As Worksheet

vFiles = Application.GetOpenFilename(FileFilter:= _
"Microsoft Excel Files (*.xls), *.xls", _
Title:="Select workbooks for which to clear print areas", _
MultiSelect:=True)

If TypeName(vFiles) < "Boolean" Then
Application.ScreenUpdating = False
For Each fil In vFiles
Set wb = Workbooks.Open(fil)
For Each ws In wb.Worksheets
ws.PageSetup.PrintArea = ""
Next ws
wb.Close SaveChanges:=True
Next fil
Application.ScreenUpdating = True
End If
End Sub


GetOpenFilename returns an array containing paths of selected workbooks.
You can then loop through that array, opening each workbook. Once a
workbook is opened, you can loop through each of its worksheets and clear
the print area, saving and closing the workbook when you're done.
Application.ScreenUpdating will keep the screen from flailing wildly while
this is running (and speed things up).

--
Regards,

Jake Marx
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


hurdler wrote:
This may be way simple, but could use some help starting. I want to
be able to select a number of excel files from a menu list and then
perfom a simple macro in every worksheet in each of those files.
These steps

- select files for batch
- Loopt through files
- Loop through worksheets in each file
- run a simple macro sequence (Clear Print Area)

thanks



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from
http://www.ExcelForum.com/


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
Workbook Compare utility Tim Zych Excel Discussion (Misc queries) 0 January 16th 09 01:31 AM
Workbook Compare utility Tim Zych Excel Worksheet Functions 0 January 16th 09 01:31 AM
Charting Utility Usage rchacon Charts and Charting in Excel 2 May 12th 06 12:28 PM
compare.xla utility wnfisba Excel Discussion (Misc queries) 1 September 7th 05 08:51 PM
Chelmsford Utility DaveB Excel Discussion (Misc queries) 2 December 16th 04 08:51 PM


All times are GMT +1. The time now is 05:52 PM.

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"