Macro to convert lines(straight or curved) into points

I was wondering if there is a way to create a macro similar to the reference points tool that could;

1.)Step1:generate n number of points along a line. (Reference points is limited to 100 points but its exactly what I would like to replicate)

     It could take any sketch and turn any lines within the sketch into the points

From this

To this

2.)Step2: Export all xyz data from points created from the reference point tool feature or created from step 1 to Excel. I know how to do this for points contained within a single sketch but the reference tool I'm not quite sure.

SolidworksApi macros