Results 1 to 3 of 3

Thread: [RESOLVED] Parsing Words from Visio Form Textbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    11

    Resolved [RESOLVED] Parsing Words from Visio Form Textbox

    Hello,

    I am trying to extract the individual words that are comma delimited in a userform textbox into an array where each word has its own reference in the array.

    For example, if the following is put in the textbox:
    CMD,EXT,VEH,PER

    I want an array 'A' with
    A(1) = CMD
    A(2) = EXT
    .
    .
    .

    I've found a couple VBA examples on parsing sentences, but Visio doesn't seem to have the same functions that they are using. Can anyone lend me a hand. I am new to VBA.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Parsing Words from Visio Form Textbox

    a = split(textbox1, ",")

    if that does not work, specify the version of vba included with visio
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Parsing Words from Visio Form Textbox

    Welcome to the forums

    vb Code:
    1. Sub Sample()
    2.     '~~> Replace MyArray() by A() if you wish
    3.     Dim MyArray() As String
    4.    
    5.     '~~> I am using StrSample as an example.
    6.     '~~> Replace it with Textbox1.Text
    7.     StrSample = "CMD,EXT,VEH,PER"
    8.    
    9.     '~~> Split the string based on the delimiter
    10.     MyArray = Split(StrSample, ",")
    11.    
    12.     '~~> This is to just display what the array contains
    13.     '~~> Replace it with your code
    14.     For i = 0 To UBound(MyArray)
    15.         MsgBox MyArray(i)
    16.     Next i
    17. End Sub

    Edit: Pete beat me to it
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width