fredlo2010
04-04-2014, 07:37 AM
Hello guys,
I have a problem with a workbook and really do not know how to fix it. I have been looking around Link (http://answers.microsoft.com/en-us/office/forum/office_2007-customize/excel-2007-crashes-when-saving-an-xlsm-file-filled/446ec156-84c6-460c-b7c6-75bec12216a8) but no luck. Basically it crashes every time I tried to save it via VBA.
These are all the things I have tried:
Save it manually (works)
Using Workbooks.Save (fails)
Using Workbooks.SaveAs (fails)
Using Workbok.Close true (fails)
Removing all ActiveX controls (fails)
After using CodeCleaner (fails)
Any ideas ?
This is the code I am using; its part of a bigger workbook that updates a sheet in several files. All the other files work.
Private Sub Update(strFileName, strPassword, strHomeName, intHomeRow, intHomeCol)
Dim wbToUpdate As Workbook
' Open the specified macro and make the fund sheet visible
Set wbToUpdate = Workbooks.Open(strFileName, False, False, , strPassword, strPassword)
With wbToUpdate
.Sheets(strDataSheet).Visible = True
' Paste the information
.Sheets(strDataSheet).Select
Cells(1, 1).Select
ActiveSheet.Paste
' Hide the sheet
.Sheets(strDataSheet).Visible = xlSheetVeryHidden
' Select the landing Home page and its corresponding cell.
.Sheets(strHomeName).Select
Cells(intHomeRow, intHomeCol).Select
' Save and close the workbook
'.Save
'.SaveAs strFileName, 52, strPassword, strPassword
'.Close SaveChanges:=True
.Close
End With
End Sub
Thanks a lot for the help :)
I have a problem with a workbook and really do not know how to fix it. I have been looking around Link (http://answers.microsoft.com/en-us/office/forum/office_2007-customize/excel-2007-crashes-when-saving-an-xlsm-file-filled/446ec156-84c6-460c-b7c6-75bec12216a8) but no luck. Basically it crashes every time I tried to save it via VBA.
These are all the things I have tried:
Save it manually (works)
Using Workbooks.Save (fails)
Using Workbooks.SaveAs (fails)
Using Workbok.Close true (fails)
Removing all ActiveX controls (fails)
After using CodeCleaner (fails)
Any ideas ?
This is the code I am using; its part of a bigger workbook that updates a sheet in several files. All the other files work.
Private Sub Update(strFileName, strPassword, strHomeName, intHomeRow, intHomeCol)
Dim wbToUpdate As Workbook
' Open the specified macro and make the fund sheet visible
Set wbToUpdate = Workbooks.Open(strFileName, False, False, , strPassword, strPassword)
With wbToUpdate
.Sheets(strDataSheet).Visible = True
' Paste the information
.Sheets(strDataSheet).Select
Cells(1, 1).Select
ActiveSheet.Paste
' Hide the sheet
.Sheets(strDataSheet).Visible = xlSheetVeryHidden
' Select the landing Home page and its corresponding cell.
.Sheets(strHomeName).Select
Cells(intHomeRow, intHomeCol).Select
' Save and close the workbook
'.Save
'.SaveAs strFileName, 52, strPassword, strPassword
'.Close SaveChanges:=True
.Close
End With
End Sub
Thanks a lot for the help :)