Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clipboard use
Message
De
30/10/2001 11:47:53
 
 
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00574779
Message ID:
00575143
Vues:
24
>I need to grab multi-line, multi-field text from the clipboard but don't know how to parse it with code.
>
>Basically, I'm thinking of having the user copy 2 columns of data from an Excel spreadsheet into clipboard and paste it into the database. I could use automation but the spreadsheet will have multiple worksheets so it makes things little more complicated.
>
>How can I paste what is in the clipboard in code? Something like:
>
>For Each "line" In "clipboardtext"
> Zipcode = Left(clipboardtext,5)
> Count = Val(Mid(clipboardtext,6))
>Next

Hi John,

Haven't tested this but if your multi-line text on the clipboard has carriage return or cr/line feeds or just lf you could use a "divide and conquer" approach to this: use the Split() function with a vbCr, vbCrLf or vbLf separator to get each different line on elements of an array and then if the fields have a separator use that on each line to obtain arrays that you can do For Each.. Next on.

Does that sound doable given your clipboard text?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform