asked on # SpreadsheetGear & VB.Net -> Workbook.Names

Hello,

I am new to SpreadsheeetGear which is a tool that allows excel interactions with VB.Net.

On looking at the sample V.Net source code at http://www.spreadsheetgear.com/support/samples/srcview.aspx?file=amortizationVB.aspx and the associated Excel spreadsheet it interacts with I note in the source code it has the following:

' Open the workbook.

Dim filename As String = Server.MapPath("files/amortization.xls")

Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.GetWorkbook(filename)

' Get IRange for cells from defined names.

Dim pv As SpreadsheetGear.IRange = workbook.Names("PV").RefersToRange

Dim rate As SpreadsheetGear.IRange = workbook.Names("Rate").RefersToRange

Dim nper As SpreadsheetGear.IRange = workbook.Names("NPer").RefersToRange

Within the Excel sheet the following is displayed (where "Loan Amount (PV)" and "Annual Interest Rate (Rate)" etc are in column A and "$15,000.00" is in column B etc........

Loan Amount (PV) $15,000.00

Annual Interest Rate (Rate) 7.25%

Total # of Months (NPer) 24

While "PV", "Rate", and "NPier" are written in column A as "Loan Amount (PV)" etc... in the excel worksheet there is no other reference to such abbreviations.

My question in relation to this is: When it states "Dim pv As SpreadsheetGear.IRange = workbook.Names("PV").RefersToRange" in the VB.Net code, is it actually looking up the excel sheet for the equivalent column/value PV? I presume" PV" is hardly just defined in the worksheet by using "Loan Amount (PV)"?

If anyone can explain how this works & what the IRange values are doing then I'd appreciate all help.

Thanking you in advance

I am new to SpreadsheeetGear which is a tool that allows excel interactions with VB.Net.

On looking at the sample V.Net source code at http://www.spreadsheetgear.com/support/samples/srcview.aspx?file=amortizationVB.aspx and the associated Excel spreadsheet it interacts with I note in the source code it has the following:

' Open the workbook.

Dim filename As String = Server.MapPath("files/amor

Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.Ge

' Get IRange for cells from defined names.

Dim pv As SpreadsheetGear.IRange = workbook.Names("PV").Refer

Dim rate As SpreadsheetGear.IRange = workbook.Names("Rate").Ref

Dim nper As SpreadsheetGear.IRange = workbook.Names("NPer").Ref

Within the Excel sheet the following is displayed (where "Loan Amount (PV)" and "Annual Interest Rate (Rate)" etc are in column A and "$15,000.00" is in column B etc........

Loan Amount (PV) $15,000.00

Annual Interest Rate (Rate) 7.25%

Total # of Months (NPer) 24

While "PV", "Rate", and "NPier" are written in column A as "Loan Amount (PV)" etc... in the excel worksheet there is no other reference to such abbreviations.

My question in relation to this is: When it states "Dim pv As SpreadsheetGear.IRange = workbook.Names("PV").Refer

If anyone can explain how this works & what the IRange values are doing then I'd appreciate all help.

Thanking you in advance

Microsoft Excel.NET Programming

View this solution by signing up for a free trial.

Members can start a 7-Day free trial and enjoy unlimited access to the platform.

Thanks imnorie, that sounds as if it could be what I'm referring to. I'll leave the question open for now to see if anyone else has any further suggestions but that sounds as if it could be what "PV" etc are referring to!

View this solution by signing up for a free trial.

Members can start a 7-Day free trial and enjoy unlimited access to the platform.

Thanks Imnorie!

http://bytes.com/topic/visual-basic-net/answers/602857-how-do-i-set-initial-excel-workbook-name

http://www.downv.com/Windows/download-SpreadsheetGear-for-NET-10358157.htm

http://www.devdirect.com/all/spreadsheetgearfornet_SOLN_00010012.aspx

http://www.vbdotnetheaven.com/UploadFile/ggaganesh/ExcelSpreadsheet04182005093012AM/ExcelSpreadsheet.aspx

http://peterkellner.net/2010/09/12/spreadsheetgear-to-the-rescue-export-excel-file/