Help - Search - Members - Calendar
Full Version: Vb.net Freeze Pane In Excel
BleepingComputer.com > Software > Programming
   
RADIUM-V Interactive
So here's the situation. I'm pulling data from SQL and putting it into an Excel Sheet. I want to control formatting, and I want to be able to freeze a specific row when scrolling. I've seen some examples, but they're either for an older version of VB or an older version of Office (of which I'm using Ultimate 2007).

Are there any controls to use? Any help will be greatly appreciated.

Thanks,
John
sheril
while you writing u can format the page.

follow this and check it

http://vb.net-informations.com/excel-2007/...page_format.htm

groovicus
When you have your spreadsheet open in Excel, highlight the row or columns that you want frozen. Click the view tab at the top. In the Windows section of the ribbon is an option to 'freeze panes'. Click on that, and select the first option to freeze what you selected. Click it again to unfreeze the panes.
RADIUM-V Interactive
QUOTE(groovicus @ Apr 19 2008, 08:51 AM) *
When you have your spreadsheet open in Excel, highlight the row or columns that you want frozen. Click the view tab at the top. In the Windows section of the ribbon is an option to 'freeze panes'. Click on that, and select the first option to freeze what you selected. Click it again to unfreeze the panes.



See, that would work, but I'm creating each spreadsheet from scratch in VB.NET. I need to be able to make the panes frozen with code control, not actually going to the sheet and doing it. The whole thing is automated, including this.
groovicus
Something like this?
CODE
Dim wb As Excel.Workbook
        Dim ex As New Excel.Application
        wb = ex.Workbooks.Add
        Dim sheet As Excel.Worksheet = wb.Worksheets.Add
        ' Select the row above of what you want to freeze
        sheet.Rows(2).Select()
        sheet.Application.ActiveWindow.FreezePanes = True
        ex.Visible = True


I nabbed that from Experts Exchange.
RADIUM-V Interactive
I was hoping I didn't have to go that route, with physically selecting the area. Oh well, at least it's not as bad as adding a Totals rows to the end of the data like I have to anyway. Hail Groovicus!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.