Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


The following two Basic macros FILENAME() and FILEPATH() may help. 

~~~~~
Option Explicit
Option VBASupport 1   ' Enables InStrRev()

' Returns file name including extension.
Public Function FILENAME() As String
  Dim u As String
  Dim i As Long
  u = ConvertFromURL( ThisComponent.Url )
  i = InStrRev( u, GetPathSeparator() )
  FILENAME = Right( u, Len(u) - i )
End Function

' Returns file path excluding trailing separator.
Public Function FILEPATH() As String
  Dim u As String
  Dim i As Long
  u = ConvertFromURL( ThisComponent.Url )
  i = InStrRev( u, GetPathSeparator() )
  FILEPATH = Left( u, i - 1 )
End Function
~~~~~


-rl


Am 2012-10-20 um 13:07 schrieb Luuk <luuk34@gmail.com>:

On 19-10-2012 16:23, Samuele Zampini wrote:
I solved it with this formula:

=REPLACE(REPLACE(CELL("filename");FIND(".";CELL("filename");1);(LEN(CELL("filename"))-FIND(".";CELL("filename");1)+1);"");1;SEARCH("/[^/]*$";
CELL("filename"));"")

I like it!


its a bit too long ....

i would like CELL("shortfilename") more

CELL("Filename") should return just the name (without path)
and CELL("path") to return the path
...


-- 
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.