Please am using Corel 2017, i want a Marcos that will import text from Excel. I layed the Job 18 ups in corel draw, so i typed the serial numbers in excel, so i want to import the text to corel in such a way that it will automatic paste in the boxes i created in corel draw.
It's a scratch card job. Help me
Nobody can help you with such a week definition of what you need...
In order to receive any kind of help you must better describe what you have and what you need to obtain. For instance: "There is an open excel file, named 'test.xlsx'. It keeps on the first page, on first row some headers, and the corespondent values are on the second row.
I also have in Corel some text boxes named exactly like the headers of the Excel columns."
How can I take the values from Excel and move/''Paste' them in the appropriate text boxes of Corel...
Is this a scenario fitting what you intend to do?
Do you understand anything from the them you received?
For my proposed scenario, the necessary code would be the next:
'The code needs a reference to 'Microsoft Excel xx.x Object Library' where xx.x is the Ofice/Excel version
'installed on your computer. For instance, in my case I use 16.00 (Office 2016...)
Dim Exl As Excel.Application, w As Workbook, Wg As Workbook, Pg As Worksheet, R As Range
Dim Mf As Variant, lastColumn As Long, lastRow As Long, nLastCol As String, i As Long
Dim boolFound As Boolean
Set Exl = GetObject(, "Excel.Application")
Exl.Visible = True
For Each w In Exl.Workbooks
'If w.name = "test.xlsx" Then Set Wg = w: boolFound = True: Exit For
If w.name = "Oreo 24x12.xls" Then Set Wg = w: boolFound = True: Exit For
If Not boolFound Then MsgBox "There is not any ""test.xlsx"" open in Excel." & vbCrLf & _
"Please open it and try again", vbInformation, "Missing open Excel file": Exit Sub
Set Pg = Wg.Sheets(1): Set R = Pg.UsedRange
lastColumn = R.Columns.Count: lastRow = R.Rows.Count
nLastCol = Split(R.Cells(, lastColumn).Address, "$")(1)
Mf = Pg.Range("A1:" & nLastCol & lastRow).Value
'Now all your Excel file data are inside of the Mf array...
'________________________end Excel data collection___________
Dim shR As ShapeRange, sh As Shape
Set shR = ActivePage.Shapes.FindShapes(, cdrTextShape)
For Each sh In shR.Shapes
For i = 1 To lastColumn
If sh.name Like Mf(1, i) Then
sh.Text.Story = Mf(2, i): Exit For
'________________________end Corel data pasting________________________
I do not feel I am helping you... I would be happy at least you understand it.
Why not just use CorelDRAW's internal text merge feature:
Seems like you might also need to learn about the built-in imposition feature, a good thing to know also.