OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 03-11-2004, 07:25
Posts: n/a
Default how can we get string from...

how can we get "FALANCA SAHIS", "CUMA ROBINSON", "OSURUK KESEN JOE" names from these strings?;


Set t = ActiveLayer.CreateArtisticText(0, 0, "What we gonna write here?", , , "Stencil BT", 18, cdrFalse, cdrFalse, cdrNoFontLine, cdrCenterAlignment)
Reply With Quote
Old 03-11-2004, 13:12
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: how can we get string from...

There are a few different approaches you might choose. One is to use string functions to find where the backslashes are in the string, then get the substring after the last backslash separating the last folder name and the very last backslash that ends the string.

Here is how you can do it:

Sub GetFolderName_Method1()
    Dim Path As String
    Dim Folder As String
    Dim nLen As Integer
    Dim nPos As Integer
    nLen = Len(Path) ' Length of the string
    ' Get the position of the backslash that precedes the last folder in the path
    ' We need to ignore the very last trailing backslash in the path
    nPos = InStrRev(Path, "\", nLen - 1)
    Folder = Mid(Path, nPos + 1, nLen - nPos - 1)
End Sub
Another way, you can split the path into an array of substrings separated by "\" character. Then you can get the last but one element of the array (the last one will be empty, because the last backslash separateres the folder name from "empty" string:

Sub GetFolderName_Method2()
    Dim Path As String
    Dim Folder As String
    Dim FolderArray() As String
    FolderArray = Split(Path, "\")
    Folder = FolderArray(UBound(FolderArray) - 1)
End Sub
Either way, the Folder variable will contain your required string ("FALANCA SAHIS").
Reply With Quote
Old 04-11-2004, 03:39
Posts: n/a
Default go on learning with Alex...

thanx much, this is useful help
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing from dialog... ddonnahoe CorelDRAW/Corel DESIGNER VBA 0 25-01-2005 09:26
Reset All Variables ddonnahoe Code Critique 0 06-01-2005 08:16
Creating new document problems ddonnahoe Code Critique 2 20-11-2004 18:11
Printing Raw Prn Files Mark Code Critique 2 16-09-2004 17:15
connection string - access database diwin CorelDRAW/Corel DESIGNER VBA 2 23-11-2003 20:52

All times are GMT -5. The time now is 18:31.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com