K
Kevin Burton
For many of the tasks that I want to accomplish I am referrred to recording a
macro with in EXCEL and then looking at the results. What has become a major
obstactle is converting the VBA code to C#. For example I recorded a simple
macro for formatting a range of cells:
//Range("B11").Select
//With Selection
// .HorizontalAlignment = xlCenterAcrossSelection
// .VerticalAlignment = xlBottom
// .WrapText = False
// .Orientation = 0
// .AddIndent = False
// .IndentLevel = 0
// .ShrinkToFit = False
// .ReadingOrder = xlContext
// .MergeCells = False
//End With
The problem with this code is that in C# there doesn't seem to be xlContext,
xlBottom, and xlCenterAcrosssSelection. There doesn't seem to be a Range
object that has a Select method. There isn't a 'Selection' object. The return
from Range.Select is an object which of course doesn't have all of the
properties listed in the VBA code 'WITH'. This is just a smple example I can
see more anomalies popping up with the VBA code gets more complicated.
Suggestions?
Thank you.
Kevin
macro with in EXCEL and then looking at the results. What has become a major
obstactle is converting the VBA code to C#. For example I recorded a simple
macro for formatting a range of cells:
//Range("B11").Select
//With Selection
// .HorizontalAlignment = xlCenterAcrossSelection
// .VerticalAlignment = xlBottom
// .WrapText = False
// .Orientation = 0
// .AddIndent = False
// .IndentLevel = 0
// .ShrinkToFit = False
// .ReadingOrder = xlContext
// .MergeCells = False
//End With
The problem with this code is that in C# there doesn't seem to be xlContext,
xlBottom, and xlCenterAcrosssSelection. There doesn't seem to be a Range
object that has a Select method. There isn't a 'Selection' object. The return
from Range.Select is an object which of course doesn't have all of the
properties listed in the VBA code 'WITH'. This is just a smple example I can
see more anomalies popping up with the VBA code gets more complicated.
Suggestions?
Thank you.
Kevin