Document Not Saved Error

Submersed

Board Regular
Joined
Jul 6, 2007
Messages
167
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a loop which creates a new workbook (.xlsx), copies and pastes data into it and then saves as .xls, It seems to work fine for a while and then comes up with 'Document Not Saved' - Anyone got an ideas why?

Code:
ActiveWorkbook.SaveAs Filename:="D:\Data\Temp\VOB-II.xls", FileFormat:=56

and I have tried:
ActiveWorkbook.SaveAs Filename:="D:\Data\Temp\VOB-II.xls", FileFormat:=xlExcel8

Thanks in advance!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I have created this, as this is almost what it is doing....this even runs a few times and ends up bugging out...

Code:
Private Sub test()

On Error GoTo Err_Handler

For A = 1 To 50
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="D:\Data\Temp\XPRIMNT.xls", _
        FileFormat:=xlExcel8
ActiveWorkbook.SaveAs Filename:="D:\Data\Temp\XPRIMNT.xlsx", _
        FileFormat:=51
Application.DisplayAlerts = True
Next A

Err_Handler:

MsgBox Err.Number & " " & Err.Description

End Sub

Any ideas? Just it just go to fast for itselfs and doesn't save the file correctly?
 
Upvote 0
Sorry people, missed out a very important factor...the D: is a network drive!
 
Upvote 0

Forum statistics

Threads
1,224,558
Messages
6,179,512
Members
452,920
Latest member
jaspers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top