LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro recently quit working


Thank you for trying again the issue is whyit works with f5 or f8 with
breakpoint but not in auto?



Since this code is what i have been using (excpt for debug portions) it
reacted the same way when I add it to my file. this portion worked but then
failed just like mine did in auto after the 2nd open.

Public HeadLine As String
Public ThisLine As String
Public Checkfilenum
Public TotalRows
Public NDresults

Sub CombineMultFiles()
' CombMultFiles() loads selected text files from disk and calls
' Comb_1 to add the Data (2) worksheet from each file individually
'
'
'
Application.ScreenUpdating = False

'Global initialization
HeadLine = "FirstOne"
Checkfilenum = 0
' Check to see if values were set by add data routine
' and the program called from there

If IsEmpty(TotalRows) Then ' <<<<breakpoint for f5 continue of f8 step
TotalRows = 0
NDresults = 1
End If
' Standard routine for requesting file names
Dim fn As Variant, f As Integer
fn = Application.GetOpenFilename("Text Files (*.txt),*.txt", 1, "Select One
Or More Stat files To Combine/process", , True)
If TypeName(fn) = "Boolean" Then Exit SubIf TypeName(fn) = "Boolean" Then
Exit Sub
End if
'<<<<beep code was tried here
For f = 1 To UBound(fn)

Workbooks.OpenText Filename:=fn(f) _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:= _
False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
' ********** file did open ***********

ThisLine = Range("A6").Value ' added breakpoint here but it never got here.
Application.DisplayAlerts = False
Call Comb_1
Next f
Workbooks("dresults.xls").Activate
newfilename = "combinedfiles" + Str(NDresults) + ".xls"
ActiveWorkbook.SaveAs Filename:=newfilename, FileFormat:=xlNormal
Application.ScreenUpdating = True
If Checkfilenum 0 Then
errmes = "There was a total of " + Str(Checkfilenum) + " files that
failed."
MsgBox (errmes)
End If
If NDresults 1 Then
errmes = "There was a total of " + Str(NDresults) + " combinedfiles
created from this data."
MsgBox (errmes)
End If
For I = 1 To 30 ' Loop 3 times.
Beep ' Sound a tone.
Next I

End Sub


"Jacob Skaria" wrote:

Try...........

Dim intTemp As Integer
Dim vartemp As Variant

vartemp = Application.GetOpenFilename(FileFilter:="Text Files
(*.txt),*.txt", _
FilterIndex:=1, Title:="<Your Title", MultiSelect:=True)

If IsArray(vartemp) Then
For intTemp = 1 To UBound(vartemp)
Debug.Print vartemp(intTemp)
Next
End If



If this post helps click Yes
---------------
Jacob Skaria


"jimjk" wrote:

I have a macro which Has been in use for several months. Recently it failed
so I started up the editor and step through the program manually. it worked
like it always did. Tried running in auto the same problem occured. I then
added a breakpoint. It stopped at breakpoint and I hit F5 again it completed
without a hitch. I added some do loops with a Beep and I am hearing the Beeps
before some previous steps are finished. The command before the loop is "fn =
Application.GetOpenFilename("Text Files (*.txt),*.txt", 1, "Select One Or
More Stat files To Combine/process", , True)"

 
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
functions quit working Toby John Excel Worksheet Functions 2 February 24th 10 12:30 AM
Working with most recently used colors Mel[_4_] Excel Programming 2 April 9th 09 07:29 PM
Hyperlinks quit working WLMPilot Excel Discussion (Misc queries) 0 March 11th 08 12:24 PM
calculations quit working CJ Excel Discussion (Misc queries) 24 November 17th 05 06:09 AM
Solver Macro quit working oghebrial Excel Programming 1 October 31st 04 04:11 PM


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