Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / May 2008

Tip: Looking for answers? Try searching our database.

Excel 2007 Macro Help (Excel 2003 not working in 2007)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pman - 28 May 2008 23:22 GMT
Hi Guys,

I had a Macro which was made using Excel 2003, which looked up Excel files
in a folder, formatted them, saved them, and then repeated the process for
every excel file in the folder.

The Problem is that the I.T in my company upgraded me to Office 2007 today,
and now I cannot get the Loop to work. The excel files that the macro is
trying to open are saved as .xls. Below is the coding I've used (which was
again created using Ron's tips). I'd appreciate if someone could let me know
what I'm doing wrong since I have to create these formatted excel files
(around 450 of them) by end of day tomorrow.

Dim oFSO
Dim Folder As Object
Dim Files As Object
Dim file As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set Folder = oFSO.GetFolder("Folder location")
For Each file In Folder.Files
If file.Type Like "*Microsoft Excel*" Then
Workbooks.Open Filename:=file.Path

*complete formatting*

End If

Next file
Set oFSO = Nothing

Thanks Guys,
Norman Jones - 29 May 2008 02:17 GMT
Hi Pman,

In what way does the code not work?

If  you encounter an error, what is the
error number and message, and which
line of code is highlighted?

---
Regards.
Norman

> Hi Guys,
>
[quoted text clipped - 31 lines]
>
> Thanks Guys,
Pman - 29 May 2008 18:06 GMT
Thanks for your replies Norman and Ron. The Macro simply wasn't picking up
files to format. But I figured out why......I changed the filetype the Macro
looked up from "Microsoft Excel" to plain "Excel" and it picked up the files
to format :)

Thanks,

Prash
Ron de Bruin - 29 May 2008 18:29 GMT
hi Pman

That's why I check the extensions

Now with the new formats in 2007 you also have more control.
You can do only xls or xlsx or xlsm or ??

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> Thanks for your replies Norman and Ron. The Macro simply wasn't picking up
> files to format. But I figured out why......I changed the filetype the Macro
[quoted text clipped - 4 lines]
>
> Prash
Ron de Bruin - 29 May 2008 17:57 GMT
See this example
http://www.rondebruin.nl/copy4.htm

Signature

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

> Hi Guys,
>
[quoted text clipped - 29 lines]
>
> Thanks Guys,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.