whitoulias
Board Regular
- Joined
- Jun 22, 2012
- Messages
- 153
Code:
Sub Opendat()
Dim MyFolder As String
On Error GoTo Errorcatch
Dim MyFile As String
MyFolder = "C:\Documents and Settings\Xxxxx\Desktop\" 'put your folder here
MyFile = Dir(MyFolder & "\*.dat")
Do While MyFile <> ""
Workbooks.Open Filename:=MyFolder & "\" & MyFile
MyFile = Dir
Loop
ActiveWorkbook.SaveAs "report1", FileFormat:=xls, CreateBackup:=False
Errorcatch:
MsgBox Err.Description
End Sub
I have a .dat file which i open with the above code
The above code is run by another xls
The problem is that when i try to save the new xls i get the following message
Method 'Save as' of object '_Workbook' failed
Any ideas
THX