|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Export Data to ExcelI'm trying to export data to an Excel worksheet. I can export the data in
the cell values perfectly. I need the code to change a header and footer for the worksheet, not for the columns. Is this possible? If so, I really need the code immediately. Thank you, Elena "Elena" <El***@discussions.microsoft.com> schrieb Have a look at the Excel object model in the Excel documentation. You can > I'm trying to export data to an Excel worksheet. I can export the > data in the cell values perfectly. > > I need the code to change a header and footer for the worksheet, not > for the columns. > > Is this possible? If so, I really need the code immediately. use Excel via COM interop by setting a reference to the "Microsoft Excel x.y object library" on the COM folder on the "add references" dialog. See also: http://support.microsoft.com/kb/301982/en-us Armin I'm not sure what you mean. I looked at the article you pointed me to and I
only see ranges or cells. This is the header/footer outside of the cells and on the sheet itself. I'm sorry if I wasn't clear before. I already have the library referenced. You need it to be able to export anything to Excel. Show quoteHide quote "Armin Zingler" wrote: > "Elena" <El***@discussions.microsoft.com> schrieb > > I'm trying to export data to an Excel worksheet. I can export the > > data in the cell values perfectly. > > > > I need the code to change a header and footer for the worksheet, not > > for the columns. > > > > Is this possible? If so, I really need the code immediately. > > > Have a look at the Excel object model in the Excel documentation. You can > use Excel via COM interop by setting a reference to the "Microsoft Excel x.y > object library" on the COM folder on the "add references" dialog. > > See also: > http://support.microsoft.com/kb/301982/en-us > > > > Armin > > "Elena" <El***@discussions.microsoft.com> schrieb I didn't know how you exported it to an Excel file and that you already have > I'm not sure what you mean. I looked at the article you pointed me > to and I only see ranges or cells. This is the header/footer > outside of the cells and on the sheet itself. I'm sorry if I wasn't > clear before. > > I already have the library referenced. You need it to be able to > export anything to Excel. a reference to Excel and know how to use it. Therefore the link. Though, have a look at the Excel object model in the Excel documentation. See also the appropriate microsoft.public.excel.* group. Armin Show quoteHide quote > "Armin Zingler" wrote: > >> "Elena" <El***@discussions.microsoft.com> schrieb >> > I'm trying to export data to an Excel worksheet. I can export the >> > data in the cell values perfectly. >> > >> > I need the code to change a header and footer for the worksheet, not >> > for the columns. >> > >> > Is this possible? If so, I really need the code immediately. >> >> >> Have a look at the Excel object model in the Excel documentation. You can >> use Excel via COM interop by setting a reference to the "Microsoft Excel >> x.y >> object library" on the COM folder on the "add references" dialog. >> >> See also: >> http://support.microsoft.com/kb/301982/en-us >> Armin,
Let me try and be more clear: I need the VB.NET code to change the header/footer of an Excel spread sheet. I am doing it through a VB application. I can change the ranges/cell values using code, but I do not know how to change things outside of the cell ranges. I will try and post in an Excel group, but i do not need to change it in a worksheet, I need to change it through a VB application. For example, I am using this code to change values in certain cells: 'open excel document Dim ThisApplication As Excel.Application ThisApplication = New Excel.Application ' Start Excel and get Application object. ThisApplication = CreateObject("Excel.Application") ThisApplication.Visible = True 'connection for package Dim Wb As Excel.Workbook = ThisApplication.Workbooks.Open("C:\CDRLReview.xls") Dim CDRLWs As Excel.Worksheet = Wb.Worksheets(1) Dim DIDWs As Excel.Worksheet = Wb.Worksheets(2) DIDWs.Range("a2").Value = "There is no DID associated with this CDRL." DIDWs.Range("a2").Font.ColorIndex = 3 DIDWs.Range("a2").Font.Bold = True This code works! Yet, I need to change the Worksheet's header in the same fashion. I need to know if i can do something like: DIDWs.Header.Value = <~~ I don' t know what the correct code is, it's just an example. ~Elena Show quoteHide quote "Armin Zingler" wrote: > "Elena" <El***@discussions.microsoft.com> schrieb > > I'm not sure what you mean. I looked at the article you pointed me > > to and I only see ranges or cells. This is the header/footer > > outside of the cells and on the sheet itself. I'm sorry if I wasn't > > clear before. > > > > I already have the library referenced. You need it to be able to > > export anything to Excel. > > > I didn't know how you exported it to an Excel file and that you already have > a reference to Excel and know how to use it. Therefore the link. Though, > have a look at the Excel object model in the Excel documentation. See also > the appropriate microsoft.public.excel.* group. > > Armin > > > > "Armin Zingler" wrote: > > > >> "Elena" <El***@discussions.microsoft.com> schrieb > >> > I'm trying to export data to an Excel worksheet. I can export the > >> > data in the cell values perfectly. > >> > > >> > I need the code to change a header and footer for the worksheet, not > >> > for the columns. > >> > > >> > Is this possible? If so, I really need the code immediately. > >> > >> > >> Have a look at the Excel object model in the Excel documentation. You can > >> use Excel via COM interop by setting a reference to the "Microsoft Excel > >> x.y > >> object library" on the COM folder on the "add references" dialog. > >> > >> See also: > >> http://support.microsoft.com/kb/301982/en-us > >> > > "Elena" <El***@discussions.microsoft.com> schrieb I do understand your concerns. I don't have an answer because this is a> Armin, > > Let me try and be more clear: > > I need the VB.NET code to change the header/footer of an Excel > spread sheet. I am doing it through a VB application. I can change > the ranges/cell values using code, but I do not know how to change > things outside of the cell ranges. I will try and post in an Excel > group, but i do not need to change it in a worksheet, I need to > change it through a VB application. For example, I am using this > code to change values in certain cells: question related to the Excel automation object model (that I don't know that good), not a question about VB.Net. You obviously don't have a problem in handling VB.Net but handling the Excel object model. In other words, if you did it in C#, you would have the same question. Armin "Elena" <El***@discussions.microsoft.com> schrieb Start Excel, start recordin a macro, change the header, stop recording, > This code works! Yet, I need to change the Worksheet's header in > the same fashion. > > I need to know if i can do something like: > > DIDWs.Header.Value = <~~ I don' t know what the correct code is, > it's just an example. have a look at the generated macro source code. You can apply the same cod in VB.Net then. Armin
VB.NET Automatic code typing features
"ambiguous" problem with VB.NET 2005 ComboBox ReadOnly Direct input into DataGrid? ListView.SelectedItems.Clear if result = system.dbnull Please help! Database won't update Visual Basic .net and DirectX DataGridView : selected-record changes after sorting ??? DataGridView : active-row versus Selected-row ??? |
|||||||||||||||||||||||