Hello everyone,
I have a macro that creates a new file almost similar to the one it runs on by Saving it As, copy/pasting as values every sheet and removing the old ones. It goes like this :
After this macro finishes running I am in a new Workbook pretty similar to the one I had to begin with. It is already saved and I can close it.
But when I try to reopen it afterward (only the first time), an Excel pop-up window shows up saying :
I have a macro that creates a new file almost similar to the one it runs on by Saving it As, copy/pasting as values every sheet and removing the old ones. It goes like this :
Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub Export_EDF()[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] Dim Feuille As Worksheet
Dim FeuilleRef As Worksheet
Dim Sheet As Object
Dim FichierCible As Variant
[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] Application.ScreenUpdating = False
Application.DisplayAlerts = False
FichierCible = Application.GetSaveAsFilename
If FichierCible <> False Then
MsgBox FichierCible
ThisWorkbook.SaveAs Filename:=FichierCible & "xlsm", FileFormat:=52, Password:="", ReadOnlyRecommended:=False, ConflictResolution:=xlOtherSessionChanges
Set FeuilleRef = ActiveSheet
' copy/paste as values of all worksheets
For Each Feuille In ActiveWorkbook.Worksheets
With Feuille
.Cells.Copy
.Cells.PasteSpecial Paste:=xlPasteValues
End With
Next Feuille
For Each Sheet In Worksheets
If Sheet.Visible = False Then
Sheet.Delete
End If
Next
Call RemoveButtons
FeuilleRef.Activate
End If
ActiveWorkbook.Save
Application.CutCopyMode = False
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub RemoveButtons()
If ActiveSheet.ProtectContents = True Then
End If[/FONT]
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif] On Error Resume Next
ActiveSheet.Buttons.Delete
End Sub[/FONT]
After this macro finishes running I am in a new Workbook pretty similar to the one I had to begin with. It is already saved and I can close it.
But when I try to reopen it afterward (only the first time), an Excel pop-up window shows up saying :
"We found a problem with some content in "documentname.xlsx" Do you want us to try to recover as much as we can?"
If I click 'Yes', which is what I do (, the default value is 'No'), I am presented with a dialogue box stating what was "fixed." The box states "Repaired Records: AutoFilter from /xl/worksheets/sheet1.xml part" (a lot of times) and I click on 'Close', which is the default and only option I have.
This will show up everytime I create a workbook using my macro and I can't really tell my clients to ignore the pop-up Windows and to just click on 'Yes' and then 'Close' for
My idea was to use the [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub Workbook_Open(). With a little researches I found out that I might use this to prevent Excel from asking me wheather to repare :
Sounds good, doesn't work. Unfortunately. The first pop-up window shows up before to Sub Workbook_Open() function reaches .UpdateLink.
Does anyone has any idea what to do to prevent this windows from poping up ?
Thank you very much for reading,
Marie<strike>
</strike>[/FONT]
If I click 'Yes', which is what I do (, the default value is 'No'), I am presented with a dialogue box stating what was "fixed." The box states "Repaired Records: AutoFilter from /xl/worksheets/sheet1.xml part" (a lot of times) and I click on 'Close', which is the default and only option I have.
This will show up everytime I create a workbook using my macro and I can't really tell my clients to ignore the pop-up Windows and to just click on 'Yes' and then 'Close' for
it lacks professionnalism
so I was thinking of writing a macro to do it for them (preferably without them noticing).My idea was to use the [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub Workbook_Open(). With a little researches I found out that I might use this to prevent Excel from asking me wheather to repare :
Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Private Sub Workbook_Open()
If ActiveWorkbook.Name <> "theOriginalFile'sName.xlsm" Then
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
End If
End Sub[/FONT]
Does anyone has any idea what to do to prevent this windows from poping up ?
Thank you very much for reading,
Marie<strike>
</strike>[/FONT]