View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jimjk jimjk is offline
external usenet poster
 
Posts: 4
Default Macro recently quit working

Thanks for replying:

Based on help files:
FileFilter
This string passed in the FileFilter argument consists of pairs of file
filter strings followed by the MS-DOS wildcard file filter specification,
with each part and each pair separated by commas. Each separate pair is
listed in the Files of type drop-down list box. For example, the following
string specifies two file filters€”text and addin: "Text Files
(*.txt),*.txt,Add-In Files (*.xla),*.xla". and then you add the filter index

FilterIndex Optional Variant Specifies the index numbers of the default file
filtering criteria, from 1 to the number of filters specified in FileFilter.
If this argument is omitted or greater than the number of filters present,
the first file filter is used.


The issue on this is why it quit working when it work for several months in
Office 2007 and it works if I single step (F8) through the program or even if
I add a break at if isempty and the hit the f5 key to continue it works fine
and finishes the program. at one point I added the following code
For I = 1 To 30 ' Loop 30 times.
'Beep ' Sound a tone.
Next I
just after the getopenfilename command and I heard the beep prior to
responding to getopen gui.


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 '<<<<<<<<<< added break here
TotalRows = 0
NDresults = 1
End If
' Standard routine for requesting files
Dim fn As Variant, f As Integer
' change according to need .xls vs .txt as weel as communication information
' See append data below for use on Excel files
fn = Application.GetOpenFilename("Text Files (*.txt),*.txt", 1, "Select One
Or More data files To Combine/process", , True)

' added Beep code here to check for running sequence I heard the beep prior
' to responding to the getopenfilename command.


If TypeName(fn) = "Boolean" Then Exit Sub
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)
' Start of routines that vary for individual collection
ThisLine = Range("A6").Value ' file is opened but never ran this line
Call Comb_1
Next f


Again thank you!

"JLGWhiz" wrote:

I do not recognize the 1 as a valid part of the syntax.


"jimjk" wrote in message
...
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)"