Click here to Skip to main content
15,899,020 members
Home / Discussions / C#
   

C#

 
QuestionRe: Changing text in Glyphs in XpsDocument Pin
Richard MacCutchan6-Jan-14 22:14
mveRichard MacCutchan6-Jan-14 22:14 
AnswerRe: Changing text in Glyphs in XpsDocument Pin
defjef6-Jan-14 23:13
defjef6-Jan-14 23:13 
GeneralRe: Changing text in Glyphs in XpsDocument Pin
Richard MacCutchan6-Jan-14 23:28
mveRichard MacCutchan6-Jan-14 23:28 
GeneralRe: Changing text in Glyphs in XpsDocument Pin
defjef6-Jan-14 23:39
defjef6-Jan-14 23:39 
GeneralRe: Changing text in Glyphs in XpsDocument Pin
Richard MacCutchan6-Jan-14 23:58
mveRichard MacCutchan6-Jan-14 23:58 
GeneralRe: Changing text in Glyphs in XpsDocument Pin
defjef7-Jan-14 0:03
defjef7-Jan-14 0:03 
GeneralRe: Changing text in Glyphs in XpsDocument Pin
Richard MacCutchan7-Jan-14 0:26
mveRichard MacCutchan7-Jan-14 0:26 
QuestionIssues with using C# library in Excel 2007 VBA Pin
Wheels0126-Jan-14 5:45
Wheels0126-Jan-14 5:45 
Good morning.

I have created a library of functions in C#, and I am testing them to see if they work in both VBA and on a spreadsheet (I am ok if they only work in VBA).

I have C# code to display the LastColumn and the LastRow in a spreadsheet as follows:
/// <summary> 
/// Finds the last column on a worksheet. 
/// </summary> 
/// <param name="xlWorkSheet"></param> 
/// <returns></returns> 
public string FindLastColumn(Worksheet xlWorkSheet) 
{ 
int nInLastCol = 0; 

// Find the last real column 
nInLastCol = xlWorkSheet.Cells.Find("*", System.Reflection.Missing.Value, System.Reflection.Missing.Value, 
System.Reflection.Missing.Value, XlSearchOrder.xlByColumns,XlSearchDirection.xlPrevious, 
false,System.Reflection.Missing.Value,System.Reflection.Missing.Value).Column; 

return GetExcelColumnName(nInLastCol); 
} 

/// <summary> 
/// Converts the column # to the corresponding letter. 
/// </summary> 
/// <param name="columnNumber"></param> 
/// <returns></returns> 
private string GetExcelColumnName(int columnNumber) 
{ 
int dividend = columnNumber; 
string columnName = String.Empty; 
int modulo; 

while (dividend > 0) 
{ 
modulo = (dividend - 1) % 26; 
columnName = Convert.ToChar(65 + modulo).ToString() + columnName; 
dividend = (int)((dividend - modulo) / 26); 
} 

return columnName; 
} 

/// <summary> 
/// Finds the last row on a worksheet. 
/// </summary> 
/// <param name="xlWorkSheet"></param> 
/// <returns></returns> 
public long FindLastRow(Worksheet xlWorkSheet) 
{ 
long nInLastRow = 0; 

// Find the last real row 
nInLastRow = xlWorkSheet.Cells.Find("*", System.Reflection.Missing.Value, 
System.Reflection.Missing.Value, System.Reflection.Missing.Value, 
XlSearchOrder.xlByRows,XlSearchDirection.xlPrevious, 
false,System.Reflection.Missing.Value,System.Reflection.Missing.Value).Row; 
return nInLastRow; 
}


The FindLastColumn code works in VBA, but the FindLastRow does not, and neither works on a sheet (not sure how to correctly pass in the current sheet). The error is: Function or interface marked as retricted, or the function uses an Automation type not supported in Visual Basic.

VBA:
Dim TSExcelLib As New TechSolutionsXLLibrary.ExcelFunctions 

Private Sub CommandButton1_Click() 

MsgBox TSExcelLib.FindLastColumn(Sheets("Sheet1")) 'Works 
MsgBox TSExcelLib.FindLastColumn(Sheet1) 'Works 

MsgBox TSExcelLib.FindLastColumn(Sheets("Sheet1")) 'Doesn't work 
MsgBox TSExcelLib.FindLastColumn(Sheet1) 'Doesn't work 



Any insight would be greatly appreciated. WHEELS
AnswerRe: Issues with using C# library in Excel 2007 VBA Pin
Dave Kreskowiak6-Jan-14 7:52
mveDave Kreskowiak6-Jan-14 7:52 
GeneralRe: Issues with using C# library in Excel 2007 VBA Pin
Wheels0126-Jan-14 8:46
Wheels0126-Jan-14 8:46 
GeneralRe: Issues with using C# library in Excel 2007 VBA Pin
Chris Quinn6-Jan-14 21:35
Chris Quinn6-Jan-14 21:35 
AnswerRe: Issues with using C# library in Excel 2007 VBA Pin
TnTinMn6-Jan-14 12:03
TnTinMn6-Jan-14 12:03 
Questionwpf prompbox Pin
Member 93270026-Jan-14 3:40
Member 93270026-Jan-14 3:40 
AnswerRe: wpf prompbox Pin
Pete O'Hanlon6-Jan-14 3:59
mvePete O'Hanlon6-Jan-14 3:59 
QuestionPopulate a DVG from a csv file Pin
JOHNNYDEMICHAEL5-Jan-14 7:45
JOHNNYDEMICHAEL5-Jan-14 7:45 
AnswerRe: Populate a DVG from a csv file Pin
Dave Kreskowiak5-Jan-14 8:27
mveDave Kreskowiak5-Jan-14 8:27 
GeneralRe: Populate a DVG from a csv file Pin
JOHNNYDEMICHAEL5-Jan-14 12:13
JOHNNYDEMICHAEL5-Jan-14 12:13 
GeneralRe: Populate a DVG from a csv file Pin
Dave Kreskowiak5-Jan-14 12:24
mveDave Kreskowiak5-Jan-14 12:24 
GeneralRe: Populate a DVG from a csv file Pin
JOHNNYDEMICHAEL8-Jan-14 0:58
JOHNNYDEMICHAEL8-Jan-14 0:58 
GeneralRe: Populate a DVG from a csv file Pin
Dave Kreskowiak8-Jan-14 2:53
mveDave Kreskowiak8-Jan-14 2:53 
GeneralRe: Populate a DVG from a csv file Pin
JOHNNYDEMICHAEL9-Jan-14 2:28
JOHNNYDEMICHAEL9-Jan-14 2:28 
GeneralRe: Populate a DVG from a csv file Pin
Dave Kreskowiak9-Jan-14 4:25
mveDave Kreskowiak9-Jan-14 4:25 
AnswerRe: Populate a DVG from a csv file Pin
OriginalGriff5-Jan-14 23:03
mveOriginalGriff5-Jan-14 23:03 
AnswerRe: Populate a DVG from a csv file Pin
Eddy Vluggen6-Jan-14 8:13
professionalEddy Vluggen6-Jan-14 8:13 
QuestionReading values from window-form to XNA Pin
larsp7775-Jan-14 0:42
larsp7775-Jan-14 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.