Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Sub SaveCertificateAs()
sPath = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini"
Set oVars = ActiveDocument.Variables
CertNo = System.PrivateProfileString(sPath, "MacroSettings", "CertificateNumber")
If Not ActiveDocument.Path = "" Then
ActiveDocument.Save
Else 'The document has not been previously saved, so save it
With Dialogs(wdDialogFileSaveAs)
.Name = "Certificate " & Format(oVars("varSaveNo"), sFormat)
.Show
End With
End If
ActiveDocument.Close
End Sub
Sub AutoClose() 'Recycles number if the document was unsaved.'
sPath = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini"
Set oVars = ActiveDocument.Variables
CertNo = System.PrivateProfileString(sPath, "MacroSettings", "CertificateNumber")
If ActiveDocument.Name Like "Document#*" Then
If MsgBox("This Certificate has not been saved." & vbCr _
& "Do you want to save before closing?", vbYesNo, "MacroSettings") = vbYes Then
With Dialogs(wdDialogFileSaveAs)
.Name = "Certificate " & Format(oVars("varSaveNo"), sFormat)
.Show
End With
Else ' Close the document and recycle the number
If CertNo = oVars("varCertNo") Then
MsgBox "The current number " & "will be recycled.", vbOKCancel, "Recycle"
System.PrivateProfileString(sPath, "MacroSettings", "CertificateNumber") = CertNo - 1
End If
End If
ActiveDocument.Saved = True
End If
End Sub
Sub ResetStartNo()
sPath = Options.DefaultFilePath(wdStartupPath) & "\Settings.ini"
Set oVars = ActiveDocument.Variables
CertNo = System.PrivateProfileString(sPath, "MacroSettings", "CertificateNumber")
CertNo = InputBox("Reset certificate number?", "Reset", CertNo)
oVars("varSaveNo").Value = CertNo
System.PrivateProfileString(sPath, "MacroSettings", "CertificateNumber") = CertNo
oVars("varCertNo").Value = CertNo
For Each oHead In ActiveDocument.Sections(1).Headers
If oHead.Exists Then
For Each oField In oHead.range.Fields
oField.Update
Next oField
End If
Next oHead
End Sub
Private Sub Document_Open()
Dim prp As Object
Dim aDoc As Document
Dim chk As Boolean
Set aDoc = ActiveDocument
For Each prp In ActiveDocument.CustomDocumentProperties
If prp.Name = "teller" Then chk = True
Exit For
Next prp
If chk = True Then
aDoc.CustomDocumentProperties("teller").Value = aDoc.CustomDocumentProperties("teller").Value + 1
Else
aDoc.CustomDocumentProperties.Add Name:="teller", LinkToContent:=False, Value:=1, Type:=msoPropertyTypeNumber
End If
MsgBox "Dit document is nu " & ActiveDocument.CustomDocumentProperties("teller").Value & " keer geopend...",vbOK
End Sub
Private Sub Document_Open()
Dim prp As Object
Dim aDoc As Document
Dim chk As Boolean
Set aDoc = ActiveDocument
For Each prp In ActiveDocument.CustomDocumentProperties
If prp.Name = "teller" Then chk = True
Exit For
Next prp
If chk = True Then
aDoc.CustomDocumentProperties("teller").Value = aDoc.CustomDocumentProperties("teller").Value + 1
Else
aDoc.CustomDocumentProperties.Add Name:="teller", LinkToContent:=False, Value:=1, Type:=msoPropertyTypeNumber
End If
Selection.TypeText Text:=" "
Selection.TypeBackspace
ActiveDocument.Save
MsgBox "Dit document is nu " & ActiveDocument.CustomDocumentProperties("teller").Value & " keer geopend...", vbOK
End Sub
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.