oceanrace
Gebruiker
- Lid geworden
- 14 mei 2008
- Berichten
- 198
Code:
[COLOR="yellow"]Sub Opslaanzonderformules()[/COLOR]
Dim strFileName As Variant, strPath As String
Dim VBProj As VBIDE.VBProject, VBComp As VBIDE.VBComponent, CodeMod As VBIDE.CodeModule
strFileName = Application.GetSaveAsFilename(InitialFileName:=strPath & [AJ2], _
FileFilter:="Excel Files (*.xls), *.xls, Excel 2007 Files (*.xlsm), *.xslm", _
FilterIndex:=1, _
Title:="Kies de juiste map en pas eventueel de bestandsnaam aan!")
If strFileName = False Then
MsgBox "Oh oh... je hebt niet opgeslagen! "
Else
ActiveSheet.Copy
With ActiveWorkbook
With .Sheets("blad1")
.Unprotect
.UsedRange.Value = .UsedRange.Value
.Protect
End With
Set VBProj = .VBProject
For Each VBComp In VBProj.VBComponents
If VBComp.Type = vbext_ct_Document Then
Set CodeMod = VBComp.CodeModule
With CodeMod
.DeleteLines 1, .CountOfLines
End With
Else
VBProj.VBComponents.Remove VBComp
End If
Next VBComp
.SaveAs Filename:=strFileName
End With
MsgBox "Gelukt! Opgeslagen als: " & strFileName
End If
End Sub
Ik krijg een compileerfout...