Hi
I am plotting a large number of circles (70,000) in Coreldraw and would like to be able to do this directly from CorelDraw (I have been doing it using a CSV file, which works fine but I cant help but want to see it done better).
The file is called PLOT and has a sheet called CALCS which contains 6 rows of data which give;
x and y cordinates, radius of cicrle to be plotted and the circles colour in RGB
The spreadsheet also contains 2 cells which show the 1st and last row numbers to be plotted. (cells A3 and A4)
The Macro code below is intended to run in CorelDraw with Excel open and Im reasonably confident that the bits that relate to Coreldraw work, but I am unsure of the Excel bits. In particular what should the Get Object be referencing? and should there be commas in between the letters and digits of the cell references. (see italics below).
I would appreciate it if someone would have a look and comment on what I need to do to get the info in.
best wishes
Nic
Sub GetXcel()
Dim XL As Object 'The Excel apllication
Dim Ro1st As Double 'Will contain the value of - 1st Row in Sheet to be processed
Dim RoFin As Double 'Will contain the value of - Final Row in the sheet to be processed
Dim sCircle As Shape
Dim x As Double, y As Double, Rd As Double ' x,y co ordinates and radius of circle to be plotted
Dim R As Double, G As Double, B As Double ' the colour the circle is to be in RGB
ActiveDocument.Unit = cdrMillimeter 'Set Corel to work in Millimeters
Set XL = GetObject(sheet1, "Excel.Application")
Ro1st = XL.Cells(A3).Value ' cell A3 contains the value for the 1st Row
RoFin = XL.Cells(A4).Value ' cell A4 contains the value of the Final row
Optimization = True ' turn off updating the screen etc.
For n = Ro1st To RoFin
x = XL.Cells(e, n).Value ' start to set values for variables
y = XL.Cells(f, n).Value
Rd = XL.Cells(G, n).Value
R = XL.Cells(h, n).Value
G = XL.Cells(i, n).Value
B = XL.Cells(j, n).Value
Set sCircle = ActiveLayer.CreateEllipse2(x, y, Rd) ' place circle at x,y with radius Rd
sCircle.Fill.UniformColor.RGBAssign R, G, B
Next n
Optimization = False ' turn on updating the screen etc.
End Sub
I am plotting a large number of circles (70,000) in Coreldraw and would like to be able to do this directly from CorelDraw (I have been doing it using a CSV file, which works fine but I cant help but want to see it done better).
The file is called PLOT and has a sheet called CALCS which contains 6 rows of data which give;
x and y cordinates, radius of cicrle to be plotted and the circles colour in RGB
The spreadsheet also contains 2 cells which show the 1st and last row numbers to be plotted. (cells A3 and A4)
The Macro code below is intended to run in CorelDraw with Excel open and Im reasonably confident that the bits that relate to Coreldraw work, but I am unsure of the Excel bits. In particular what should the Get Object be referencing? and should there be commas in between the letters and digits of the cell references. (see italics below).
I would appreciate it if someone would have a look and comment on what I need to do to get the info in.
best wishes
Nic
Sub GetXcel()
Dim XL As Object 'The Excel apllication
Dim Ro1st As Double 'Will contain the value of - 1st Row in Sheet to be processed
Dim RoFin As Double 'Will contain the value of - Final Row in the sheet to be processed
Dim sCircle As Shape
Dim x As Double, y As Double, Rd As Double ' x,y co ordinates and radius of circle to be plotted
Dim R As Double, G As Double, B As Double ' the colour the circle is to be in RGB
ActiveDocument.Unit = cdrMillimeter 'Set Corel to work in Millimeters
Set XL = GetObject(sheet1, "Excel.Application")
Ro1st = XL.Cells(A3).Value ' cell A3 contains the value for the 1st Row
RoFin = XL.Cells(A4).Value ' cell A4 contains the value of the Final row
Optimization = True ' turn off updating the screen etc.
For n = Ro1st To RoFin
x = XL.Cells(e, n).Value ' start to set values for variables
y = XL.Cells(f, n).Value
Rd = XL.Cells(G, n).Value
R = XL.Cells(h, n).Value
G = XL.Cells(i, n).Value
B = XL.Cells(j, n).Value
Set sCircle = ActiveLayer.CreateEllipse2(x, y, Rd) ' place circle at x,y with radius Rd
sCircle.Fill.UniformColor.RGBAssign R, G, B
Next n
Optimization = False ' turn on updating the screen etc.
End Sub