LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Macro's scip Files!!!

Hi All,

I have around 20 Excel workbook that run Automatically, collect data, save it inanother workbook and close them selves.

This is great apart from sometimes "depanding on time of day" the will take 2-3 minutes to complete and other times they will take 10-20 minutes.

I though I would get round this by opening them osing another macro in another workbook, (you will see previous posts where you lot helped me, Thanks)

I first programmed the macro to open each workbook using the "Workbooks.Open(Filename:="File.xls") etc" but it was skipping files It would open them but not run the "Auto_Open" macro inside.

I figured that there was a problem with my code so I found this:-

Dim fspec As String, fpath As String
fpath = "s:\Tracking\Autorun" fspec = "*.xls" With Application.FileSearch
.NewSearch
.LookIn = fpath
.Filename = fspec
If .Execute 0 Then
Dim i As Integer
For i = 1 To .FoundFiles.Count
'Do not re-open this workbook
If .FoundFiles(i) < ThisWorkbook.Name Then
With Application
.Calculation = xlManual
.CalculateBeforeSave = False
End With
'Add open file to workbooks collection
Workbooks.Open(Filename:=.FoundFiles(i), Updatelinks:=0 _
).RunAutoMacros Which:=xlAutoOpen
Application.DisplayAlerts = False
ActiveWorkbook.Close
End If '.FoundFiles...
Next i 'Loop
End If
End With
This opens every *.xls file in the given folder and runs the "Auto_Open" macro, we it sort of does. it does open every *.xls file but it only runs the macro for every other file.

in each *.xls file i placed this code "for testing purpuses"
Sub Auto_Open()
msgbox "File XXX is open"

End Sub



My Theroy was right it only opened and ran the macro for every second file, it does open every file but does not run the macro's..



I have gotten round this by numbering all of my files

"1 first report.xls"

"12 Dummy File"

"13 Second Report"

"14 Dummy File"

Etc,Etc,



How Do I get round this without having to have loads of dummy files??





Cheers



Mark













 
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
Help with Macro's Dan Excel Discussion (Misc queries) 0 February 5th 10 07:27 PM
Macro's Jamie Excel Worksheet Functions 1 July 2nd 09 03:31 PM
Macro's are fun Chris Excel Worksheet Functions 0 February 7th 08 06:09 AM
Macro's 148steve Excel Discussion (Misc queries) 4 November 14th 06 09:39 PM
Hide Macro's in Toolbar / Macro's list sparx Excel Discussion (Misc queries) 2 May 6th 06 08:53 PM


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