OberonPlace.com Forums  

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

Thread Tools Search this Thread Display Modes
Old 02-02-2004, 04:43
Posts: n/a
Default 2dimensional-array of directory-names

hi there once more!

i need an array of the directory-names in an directory

example of "c:\TestDirectory"

all the names "Test01" to "Directory" should be in the array in the 1st dimension.

i have a textbox where i input an filename and then the code will deliver the pathname. it should be read from the "Test01" oder "Example" the first 2 letters.
array ("SA","SB",...,"SV") (1st dimension)
(..."\\server\sv0-1000\") (2nd dimension)
textbox > "sv622" should deliver "\\server\sv0-1000\"

know what i mean? its really complicated *s*

is there a possibility?

at this time i let the script run in a workarround with a textfile where the data is stored ("SV","\\server\sv0-1000\") and so on..

but i want to include this in the code(?)

thanks for any help
Reply With Quote
Old 02-02-2004, 08:45
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: 2dimensional-array of directory-names

Frankly I have a hard time understanding what you are trying to achieve here. Could you explain a bit more?
Reply With Quote
Old 02-02-2004, 09:26
Posts: n/a
Default 2dim. arrays

hi alex!

thank you for your fast reply.

at the first it sounds all very complicated. my english is very far from perfect (i´m german) and i don´t know how to describe all the things in my head.. :-D

ok 2nd try:
i want to save my document under the filename (i.E. 'tr987.cdr`)..
in the root-directory of the final save are more than 10 dir´s with different names (of course).

so when i type in my textbox 'TR987' it should save the file in the directory beginning with 'TR'. is it ok 'til then? or is this complicated again?
until now i have a text file where stands all the values that are needed here. (i.E.> "TR","\\server\savedir\TR0_1000" and so on)
i just wonder how i would include the variables from the textfile directly in the code..(?)

it´s very funny to describe things in my german head so all of you english-reading minds would know what i mean

please let me know if there are any further misunderstandings

thank you very much for your time

best regards,

Silv R.
Reply With Quote
Old 02-02-2004, 11:23
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: 2dim. arrays

Ah, Ok, I think I've got it

Here is an example of what you can do:

Function ResolvePath(ByVal FileName As String) As String
    Dim vMap As Variant
    Dim vItem As Variant
    Dim sIndex As String
    Dim sReturn As String
    sReturn = ""

    vMap = Array( _
        Array("TR", "\\server\savedir\TR0_1000"), _
        Array("SV", "\\server\sv0-1000") _
    sIndex = UCase$(Left$(FileName, 2))
    For Each vItem In vMap
        If sIndex = vItem(0) Then
            sReturn = vItem(1) & "\" & FileName
            Exit For
        End If
    Next vItem
    ResolvePath = sReturn
End Function
This function takes your file name as input (e.g. "tr987.cdr") and returns the full file path to use (e.g. "\\server\savedir\TR0_1000\tr987.cdr")

Internally it uses "an array of arrays" map which maps the two letter prefix to the folder path. You can add more entries to the array and it will require no change to the rest of the code.

You would use the function like this:

FilePath = ResolvePath("tr987.cdr")
I hope this helps
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
Retrieve names list of constants in a given enumeration zlatev CorelDRAW/Corel DESIGNER VBA 5 09-02-2009 20:12

All times are GMT -5. The time now is 20:06.

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