Code:
Sub showTemplateInfo(Optional pDoc As Object)If IsMissing(pDoc) Then pDoc = ThisComponentOn Local Error Goto failMsgBox(templateInfo(pDoc))Exit Subfail:MsgBox("?No document!" )End SubSub showProfilePath()MsgBox(userProfilePath())End SubFunction templateInfo(Optional pDoc As Object) REM Mainly for use in Calc formulas.Dim tname As String, turl As String, out As StringIf IsMissing(pDoc) Then pDoc = ThisComponentturl = pDoc.DocumentProperties.TemplateURLIf turl="" Then turl = "<url missing>"tname = pDoc.DocumentProperties.TemplateNameREM This is the name of the link shown by the template manager.If tname="" Then tname = "<missing>"out = turl & "?" & "name=" & tnametemplateInfo _ = outEnd FunctionFunction userProfilePath() REM For use in Calc e.g.Dim substService As Object, out As StringsubstService = CreateUNOService("com.sun.star.util.PathSubstitution")out = substService.getSubstituteVariableValue("$(user)")userProfilePath _ = outEnd Function
Statistics: Posted by Lupp — Mon Jan 27, 2025 7:59 pm