Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
 
Posts: n/a
Default Exporting multiple sheets to multiple htm files?

I have a workbook that has 32 sheets in it. I would like to export each
sheet into its own htm file. Is there a way to do this automatically so
I don't have to go through and export each sheet individually? I do NOT
want to export it as a multi-sheet htm page.

Thanks...
J

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

How about this:

Option Explicit
Sub testme()
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
wks.Copy 'to a new workbook
With ActiveSheet
.Parent.SaveAs Filename:="C:\temp\" & .Name & ".htm", _
FileFormat:=xlHtml
.Parent.Close savechanges:=False
End With
Next wks
End Sub

I used the worksheet name and save into a C:\temp folder. Change these to match
your situation.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

wrote:

I have a workbook that has 32 sheets in it. I would like to export each
sheet into its own htm file. Is there a way to do this automatically so
I don't have to go through and export each sheet individually? I do NOT
want to export it as a multi-sheet htm page.

Thanks...
J


--

Dave Peterson
  #3   Report Post  
 
Posts: n/a
Default

Hey that works great. Many many thanks to you...

BTW, is there something I can add to this macro to prevent Excel from
including the document properties (name/company, etc) in the files it
outputs? I really don't want that info in there.

Thank you very much again.
J

  #4   Report Post  
 
Posts: n/a
Default

Hey that works great. Many many thanks to you...

BTW, is there something I can add to this macro to prevent Excel from
including the document properties (name/company, etc) in the files it
outputs? I really don't want that info in there.

Thank you very much again.
J

  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

Etc is a big category.

You can look at builtindocumentproperties in VBA's help to see all the ones that
can be accessed (not all are used).

Option Explicit
Sub testme()
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
wks.Copy 'to a new workbook
With ActiveSheet
.Parent.BuiltinDocumentProperties("Author").Value = ""
.Parent.BuiltinDocumentProperties("Company").Value = ""
.Parent.SaveAs Filename:="C:\temp\" & .Name & ".htm", _
FileFormat:=xlHtml
.Parent.Close savechanges:=False
End With
Next wks
End Sub

If you look at File|Properties, you can see if you want/need to include more,
too.

" wrote:

Hey that works great. Many many thanks to you...

BTW, is there something I can add to this macro to prevent Excel from
including the document properties (name/company, etc) in the files it
outputs? I really don't want that info in there.

Thank you very much again.
J


--

Dave Peterson
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
Exporting from Excel to multiple XML files Questions Excel Discussion (Misc queries) 0 March 17th 05 10:20 PM
Copying multiple sheets from one book 2 another and undertake spec Pank Mehta Excel Discussion (Misc queries) 14 March 16th 05 04:41 PM
calculating excel spreadsheet files for pensions and life insurance (including age calculation sheets) RICHARD Excel Worksheet Functions 1 March 15th 05 05:49 PM
multiple text files URGENT tasha Excel Discussion (Misc queries) 1 December 19th 04 05:44 PM
importing multiple text files??? tashayu Excel Discussion (Misc queries) 0 December 19th 04 02:43 PM


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