D
Daniel
Hello,
I have the following sub that works great for regular xls files. Now I
need to use the similar sub but to open excel files that has macros. I am
trying to open xls files without having the macro to proceed. Is there a
way to do this by amending the following code? The purpose is to open files
and then consolidate them into one.
Thank you for your help.
Sub openQuarterlyFiles()
Dim selectedFile As String
Dim wbToOpen As Integer, wsCount As Integer
With objWsQBRfreeB
lastline = Range("A32000").End(xlUp).Row
For wbToOpen = 1 To 10
'display dialog asking user to select a file
selectedFile = Application.GetOpenFilename( _
"Files (*.xls),*.xls", , "Select your Monthly Free Balance
file", , False)
'check if cancel selected then open
If selectedFile = "False" Then
MsgBox "You choose to interrupt loading files."
Call closeQBRFreeBalance
Exit For
Else
Workbooks.OpenText fileName:=selectedFile
Call openDelimitedFile(selectedFile)
End If
wsCount = Workbooks(1).Worksheets.count
Workbooks(2).Activate
Sheets(1).Move After:=Workbooks(1).Sheets(wsCount)
Next
End With
processQfiles
End Sub
I have the following sub that works great for regular xls files. Now I
need to use the similar sub but to open excel files that has macros. I am
trying to open xls files without having the macro to proceed. Is there a
way to do this by amending the following code? The purpose is to open files
and then consolidate them into one.
Thank you for your help.
Sub openQuarterlyFiles()
Dim selectedFile As String
Dim wbToOpen As Integer, wsCount As Integer
With objWsQBRfreeB
lastline = Range("A32000").End(xlUp).Row
For wbToOpen = 1 To 10
'display dialog asking user to select a file
selectedFile = Application.GetOpenFilename( _
"Files (*.xls),*.xls", , "Select your Monthly Free Balance
file", , False)
'check if cancel selected then open
If selectedFile = "False" Then
MsgBox "You choose to interrupt loading files."
Call closeQBRFreeBalance
Exit For
Else
Workbooks.OpenText fileName:=selectedFile
Call openDelimitedFile(selectedFile)
End If
wsCount = Workbooks(1).Worksheets.count
Workbooks(2).Activate
Sheets(1).Move After:=Workbooks(1).Sheets(wsCount)
Next
End With
processQfiles
End Sub