WesStewart
New Member
- Joined
- Aug 27, 2014
- Messages
- 3
hey all, I'm pretty new to vba, and I could use some help
here is the code am using. This is just a basic macro to call another macro and loop. however, it seems to be skipping everything from "workbooks.open" through "activeworkbook.saveas"
the annoying bit is that I have used this code twice before but with different file names and paths and everything worked
I have stepped-through the code and it really just seems to be skipping those lines, which it does not do in the original code.
Any help would be greatly appreciated!
here is the code am using. This is just a basic macro to call another macro and loop. however, it seems to be skipping everything from "workbooks.open" through "activeworkbook.saveas"
the annoying bit is that I have used this code twice before but with different file names and paths and everything worked
I have stepped-through the code and it really just seems to be skipping those lines, which it does not do in the original code.
Any help would be greatly appreciated!
Code:
Sub oddball_macro_loop()
'
' oddball_macro_loop Macro
'
'
Dim rawPath As String
Dim rawFile As String
Dim savePath As String
Dim oWB As Workbook
Dim fName As Variant
rawPath = "I:\Cores\DMB\E-Prime Tasks\Salience Task\Data\Macros\Raw\For macro"
rawFile = Dir(rawPath & "*.txt")
savePath = "I:\Cores\DMB\E-Prime Tasks\Salience Task\Data\Macros\Processed"
ChDir (rawPath)
Application.DisplayAlerts = True
Do While rawFile <> ""
Workbooks.Open Filename:="I:\Cores\DMB\E-Prime Tasks\Salience Task\Data\Macros\oddball_macro.xlsm"
Set oWB = Workbooks.Open(rawPath & rawFile)
Application.Run "'oddball_macro.xlsm'!oddball_macro"
Sheets("Data").Select
'Sets File Name
Dim text As String
text = Range("Z12")
fName = Mid(text, 19)
ActiveWorkbook.SaveAs Filename:=savePath & fName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close False
rawFile = Dir()
Loop
ActiveWorkbook.Close False
Application.ScreenUpdating = True
End Sub