Een familie van Microsoft-tekstverwerkingssoftware voor het maken van webinhoud, e-mails en afgedrukte documenten.
Remco,
Dat zou met onderstaande code kunnen:
Sub opslaanals()
Dim strPath As String
strPath = "H:\Mijn documenten\Evaluatie rapportage systeem"
ActiveDocument.SaveAs FileName:= _
strPath & "test" & Format(MaxFilename(strPath), "0000") & ".docx", FileFormat _
:=wdFormatXMLDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False
End Sub
Function MaxFilename(strPath As String) As Integer
Dim strFile As String
Dim strTemp As String
Dim intResult As Integer
strFile = Dir(strPath & "test*.docx")
Do Until Len(strFile) = 0
If strFile > strTemp Then
strTemp = strFile
End If
strFile = Dir
Loop
If Len(strTemp) > 0 Then
intResult = Int(Mid(strTemp, 5, 4))
End If
MaxFilename = intResult + 1
End Function
Waarbij ik als basisnaam test0002.docx heb genomen i.p.v. test2.docx
Jan