PC Review


Reply
Thread Tools Rate Thread

Converting LOTS of xls to xlsm

 
 
BillCPA
Guest
Posts: n/a
 
      5th Aug 2008
I have lots and lots of Excel 2003 workbooks with macros - almost anything I
do anymore has some kind of macro in it. And there are even more archived
files that I have to go back to every now and then.

When moving to Excel 2007, do I have to open each workbook individually and
save it as an .xlsm file, or is there some easy way to convert them all?

--
Bill @ UAMS
 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      5th Aug 2008
Since you know some VBA, I'll tell you how I'd do it. If they are all in the
same folder, you can convert them far faster.

I'd have the user enter the folder URL (quick and dirty). I have code that
allows the user to select the folder to search on, but it's pretty long.

Then I'd use the DIR function to select each Excel workbook one by one in
the folder. I'd open each xls file and then saveas .xlsm. You may want to
test for code before you save as xlsm.

Of course, you'll have to do this in Excel 2007.

I'd
--
HTH,
Barb Reinhardt



"BillCPA" wrote:

> I have lots and lots of Excel 2003 workbooks with macros - almost anything I
> do anymore has some kind of macro in it. And there are even more archived
> files that I have to go back to every now and then.
>
> When moving to Excel 2007, do I have to open each workbook individually and
> save it as an .xlsm file, or is there some easy way to convert them all?
>
> --
> Bill @ UAMS

 
Reply With Quote
 
Barb Reinhardt
Guest
Posts: n/a
 
      5th Aug 2008
Here's the code.

I commented out the saveas because I'm not on Office 2007 here yet.

Option Explicit
Public Sub SaveasXLSM()

Dim FileName As String
Dim oWB As Workbook
Dim Security As MsoAutomationSecurity

Const Folder = "C:\Documents and Settings\barbara.reinhardt\Desktop"


FileName = Dir(Folder & "\*.xls")
Do While FileName <> ""
Security = Application.AutomationSecurity
Application.AutomationSecurity = msoAutomationSecurityForceDisable
Set oWB = Workbooks.Open(Folder & "\" & FileName)
Application.AutomationSecurity = Security
Debug.Print oWB.Name
Debug.Print oWB.Path
newpath = oWB.Path & "\" & Replace(oWB.Name, ".xls", "xlsm")
Debug.Print newpath
'oWB.saveas newpath
oWB.Close
FileName = Dir
Loop

End Sub


--
HTH,
Barb Reinhardt



"BillCPA" wrote:

> I have lots and lots of Excel 2003 workbooks with macros - almost anything I
> do anymore has some kind of macro in it. And there are even more archived
> files that I have to go back to every now and then.
>
> When moving to Excel 2007, do I have to open each workbook individually and
> save it as an .xlsm file, or is there some easy way to convert them all?
>
> --
> Bill @ UAMS

 
Reply With Quote
 
Shelia L.
Guest
Posts: n/a
 
      26th Aug 2008
What is the success rate with the Excel 2003 to 2007 macro conversions? Is
there information available somewhere on what bugs/pitfalls the conversion
process may encounter?

"Barb Reinhardt" wrote:

> Here's the code.
>
> I commented out the saveas because I'm not on Office 2007 here yet.
>
> Option Explicit
> Public Sub SaveasXLSM()
>
> Dim FileName As String
> Dim oWB As Workbook
> Dim Security As MsoAutomationSecurity
>
> Const Folder = "C:\Documents and Settings\barbara.reinhardt\Desktop"
>
>
> FileName = Dir(Folder & "\*.xls")
> Do While FileName <> ""
> Security = Application.AutomationSecurity
> Application.AutomationSecurity = msoAutomationSecurityForceDisable
> Set oWB = Workbooks.Open(Folder & "\" & FileName)
> Application.AutomationSecurity = Security
> Debug.Print oWB.Name
> Debug.Print oWB.Path
> newpath = oWB.Path & "\" & Replace(oWB.Name, ".xls", "xlsm")
> Debug.Print newpath
> 'oWB.saveas newpath
> oWB.Close
> FileName = Dir
> Loop
>
> End Sub
>
>
> --
> HTH,
> Barb Reinhardt
>
>
>
> "BillCPA" wrote:
>
> > I have lots and lots of Excel 2003 workbooks with macros - almost anything I
> > do anymore has some kind of macro in it. And there are even more archived
> > files that I have to go back to every now and then.
> >
> > When moving to Excel 2007, do I have to open each workbook individually and
> > save it as an .xlsm file, or is there some easy way to convert them all?
> >
> > --
> > Bill @ UAMS

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting an .xlsm file to .xml? Janis Microsoft Excel Worksheet Functions 1 14th Mar 2010 08:53 PM
Converting xls to xlsm changes some names SteveM Microsoft Excel Misc 0 20th Aug 2009 01:01 AM
Lots of memory problems lately - dont know if motherboard turned out to be picky or theres lots of bad mem around John@Smith.com Computer Hardware 1 20th Apr 2005 05:04 PM
Lots of Frustration - Lots of Arrays, Dynamic Ranges Don't Work, Help With Options Karl Burrows Microsoft Excel Misc 4 17th Apr 2004 12:48 PM
Lots of Frustration - Lots of Arrays, Dynamic Ranges Don't Work, Help With Options Karl Burrows Microsoft Excel Discussion 6 17th Apr 2004 12:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:51 AM.