Question : Need Microsoft VBA to loop through clipboard and add records via sql statement executed by Currentdb?

All,

Please note the following item i have copied into my clipboard.

I need some VBA coding that will allow me to loop through the clipboard text and take each line item as a string and insert it as a SQL statement.

I understand already how to get my string sSQL = "INSERT INTO table ...." and do a CurrentDb.execute sSQL - I just don't have the coding to loop through the clipboard.  And I want to be sure that I don't add the first row but rather skip to the second.

IF you don't know the VBA coding to loop through the clipboard in Microsoft Access then please kindly refrain from comment.  I'd rather not try something else.  As far as exactly what I'm doing I'll handle the string part that inserts into another table.

Thanks sincerely.
1:
2:
3:
4:
5:
6:
7:
8:
Text45	cboEquip	txtName	eType	ASE	cboAltCode	cboAlternate	Qty Checked	QTYPERRM	EXQTY	new	Unitcost	txtDiscount	txtUnitcost	Remarks
$15,952	10215	Cast Removal System: Includes Hand Held Cutter wth Blade, Mobile Vacuum Cannister, and Cast Spreaders	M	0	1343	Base Bid	0	1.00	0	1.00	$2,400.00	1.00	$2,400.00	
$15,952	12706	"Workstation: Imaging Information Processor with 17"" Flat Panel Monitor; CPU and Preloaded Standard Software."	M	-1	23371	Base Bid	0	1.00	0	1.00	$3,000.00	1.00	$3,000.00	
$15,952	14215	"TV: 20"" Color, with Remote Control"	N	0	12665	Base Bid	0	3.00	0	3.00	$289.00	1.00	$867.00	
$15,952	17146	Oven: Microwave, Residential, Countertop or Cabinet Mounted	N	-1	6445	Base Bid	0	1.00	0	1.00	$650.00	1.00	$650.00	
$15,952	19661	"Stretcher: Electric, with 4"" Thick Mattress"	M	-1	1731	Base Bid	0	1.00	0	1.00	$5,600.00	1.00	$5,600.00	
$15,952	19721	Scale: Stand On, Digital, with Handrail, A/C Adapter	M	-1	1768	Base Bid	0	1.00	0	1.00	$2,595.00	1.00	$2,595.00	
$15,952	19899	"Wheelchair: Adult, Standard, 18"" wide Seat, with Anti-Fold Device, Perm Arms, Fixed Feet, Black"	N	0	21829	Base Bid	0	3.00	0	3.00	$280.00	1.00	$840.00

Answer : Need Microsoft VBA to loop through clipboard and add records via sql statement executed by Currentdb?

   Dim DataObj As New MSForms.DataObject
   Dim S As String
   Dim Lines as Variant
   Dim Line as String
   DataObj.GetFromClipboard
   S = DataObj.GetText
   'You now have a string containing the clipboard text.
   
   Lines = Split(S, Chr(13))
   'This splits the string into a set of individual lines
   For Each Line in Lines
      'Put your code to handle each line here
   Next
   
Random Solutions  
 
programming4us programming4us