Solved Run-time error 13 - Type Mismatch. Excel won't quit. Help!

February 6, 2013 at 06:30:00
Specs: Windows XP

Sub fgrtSnap()
    Dim sName, sTime, sToday
    Dim dToday, dNow As Date
        dToday = Date
        dNow = Time
        sToday = Format(dToday, "yyyymmdd")
        sTime = Format(dNow, "hh")
        sPriceType = "RateFIX"
        sPath = "C:\test\csv\"
        stbcPath = "C:\FGRT\input\"
        sName = sPath & sPriceType & sToday & "-" & sTime & ".csv"
        stbcName = stbcPath & "fgrt.csv"
    ActiveWorkbook.SaveAs Filename:=sName, FileFormat:=xlCSV
    ActiveWorkbook.SaveAs Filename:=stbcName, FileFormat:=xlCSV
    Application.DisplayAlerts = False
End Sub

See More: Run-time error 13 - Type Mismatch. Excel wont quit. Help!

Report •

February 6, 2013 at 08:10:53
✔ Best Answer


I've run your macro successfully. This may be an issue with the update Level of Excel. Read through this and see if it solves your problem.....

Report •

February 6, 2013 at 09:53:21

I do not get a type mismatch in Excel 2010 but it does ask me if I want to overwrite the existing files (twicw) and then, after I click Yes (twice), it asks me if I want to save the changes to fgrt.csv even if I have made no changes.

I am running the macro from my personal.xls with fgrt.csv as the ActiveWorkbook.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

February 6, 2013 at 10:40:06

Hi, thanks for your responses, that was very much appreciated.

- AlteK, yes I agree, the issue may be an Excel update issue. However, I have tried removing the updates (no success), re-installing latest updates (no success) repairing Microsoft Office 2010 (no success) and the next step would be to re-install Microsoft Office 2010.

-Derby, yes that's normal, if the file is ran twice within the same hour, it will prompt to save over the existing files created. The weird thing is, the computer having the problem is on a XP SP3 OS. I've tried on a PC with Windows 7 OS, as well as another PC running XP SP3, which works fine. This leads me to to think that the problem is either an Office update, Windows update or Virus issue. The process still works if I click end on the run-time error, but just an inconvenience to have to keep clicking end. If you all know of a way to stop the run-time error 13 from popping up, that would help as well. Thanks.

Report •

Related Solutions

February 6, 2013 at 12:05:27

Since I can not recreate the error, the best I can offer is this VBA debugging tutorial.

Perhaps you can use some of the troubleshooting techniques listed to help determine the problem.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

February 6, 2013 at 13:17:16

If you move the line

Application.DisplayAlerts = False

to just before the first "SaveAs" statement you will not be prompted to confirm the saves. ... for when you get it working.

Report •

February 13, 2013 at 08:22:37

Thanks for your comments AlteK and Derby. I have solved the problem by using another PC. :-) I tried removing the MS office updates and running antivirus scans, but the issue still persist. I will continue to troubleshoot and let you guys know what I find. I would like to find the problem just in case the same issue starts on the replacement PC. The issue is probably some corrupted file in the registry or something.

Report •

Ask Question