473,715 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Data to Excel

Hello,

I have created a button on my form which when pressed does the
following :

1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.

However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
if I could get the data to populate a pre-designed excel worksheet.

would anyone be able to help me do this please ?

Thanks,

J.
Nov 13 '05 #1
5 4083
Export your data into a standard worksheet and in your pre-designed excel
worksheet use formulas to get the data from that worksheet.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Jonny" <jo**********@y ahoo.com> wrote in message
news:14******** *************** ***@posting.goo gle.com...
Hello,

I have created a button on my form which when pressed does the
following :

1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.

However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
if I could get the data to populate a pre-designed excel worksheet.

would anyone be able to help me do this please ?

Thanks,

J.

Nov 13 '05 #2
Jonny wrote:
Hello,

I have created a button on my form which when pressed does the
following :

1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.

However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
if I could get the data to populate a pre-designed excel worksheet.

would anyone be able to help me do this please ?

Thanks,

J.

This has just one problem in that you can only run it once and then you
have to restart Access before you can run it again (OK for weekly or
daily reports but not if you're exporting all day) due to some glitch
I've not been able to figure out yet.

It has all the formating bits in it you'll want and methods to use to
write Spreadhseets any way you want. it includes writing headers and
footers, set Window Zoom, settin gridlines and Row/Column headings on &
off formating cells and even adding comments to cells.

Hope this helps

Option Compare Database
Option Explicit
Function ExportTravelRep ort(strDestinat ion As String) As Boolean
'On Error GoTo eh_ExportTravel Report

Dim dbLocal As Database
Dim rstTravel As Recordset
Dim intCurrTask As Integer
Dim wbknew As Excel.Workbook, wksnew As Excel.Worksheet
Dim appExcel As New Excel.Applicati on
Dim strRange As String
Dim strCurrChannel As String
Dim strRecipients As String
Dim introw As Integer
Dim intStartRow As Integer

ExportTravelRep ort = True

'open data table
Set dbLocal = CurrentDb()
Set rstTravel = dbLocal.OpenRec ordset("qry_Tra vel_Report_Outp ut",
dbOpenSnapshot)

'set up Workbook
Set wbknew = appExcel.Workbo oks.Add
Set wksnew = wbknew.Workshee ts.Add
appExcel.Visibl e = True

'write Legend
wksnew.Cells(1, 7) = "Y = Qantas full economy"
wksnew.Cells(2, 7) = "B = Qantas 5 day advance purchase economy"
wksnew.Cells(3, 7) = "V = Qantas 14 day advance purchase economy"
wksnew.Cells(4, 7) = "H = Qantas 21 day advance purchase economy"
wksnew.Cells(5, 7) = "P = Qantas First Class"
wksnew.Cells(1, 10) = "M = Special domestic"
wksnew.Cells(2, 10) = "J = Business Class"
wksnew.Cells(3, 10) = "D = Discount Business Class"
wksnew.Cells(4, 10) = "F = First Class other"

Call SetColumnWidths
Call WriteComments

rstTravel.MoveF irst
introw = 5
Do While Not rstTravel.EOF

strCurrChannel = Nz(rstTravel!Ch annelName, "unknown")
introw = WriteHeader(str CurrChannel, introw, wksnew)
intStartRow = introw

Do While rstTravel!Chann elName = strCurrChannel

'write record
wksnew.Cells(in trow, 1) = rstTravel!BSB
wksnew.Cells(in trow, 2) = rstTravel!CC
wksnew.Cells(in trow, 3) = rstTravel!Type
wksnew.Cells(in trow, 4) = rstTravel!Refer ence
wksnew.Cells(in trow, 5) = rstTravel!Passe nger
wksnew.Cells(in trow, 6) = rstTravel!Value
wksnew.Cells(in trow, 7) = rstTravel!Coupo nRouting
wksnew.Cells(in trow, 8) = rstTravel!Class Used
wksnew.Cells(in trow, 9) = rstTravel!Airli neUsed
wksnew.Cells(in trow, 10) = CStr(Format(rst Travel!DDate,
"dd/mmm/yyyy"))

wksnew.Range(Ce lls(introw, 1), Cells(introw, 10)).Select
Call SetFont(False, False, 8)
Call SetInteriorBord er
Call SetEdgeLeftBord er
Call SetEdgeRightBor der
Call SetEdgeTopBorde r
Call SetEdgeBottomBo rder
wksnew.Cells(in trow, 6).Select
Selection.Numbe rFormat = "$##,##0"
wksnew.Cells(in trow, 10).Select
introw = introw + 1
rstTravel.MoveN ext

If rstTravel.EOF Then Exit Do

Loop

Call WriteFooter(int row, wksnew, intStartRow)
introw = introw + 1

Loop

With ActiveWindow
.Zoom = 100
.DisplayGridlin es = False
.DisplayHeading s = False
End With
wksnew.Range("G 1:J5").Select
Selection.Horiz ontalAlignment = xlLeft
Call SetFont(True, False, 6)

If Dir(strDestinat ion) = Right(strDestin ation, 22) Then
Kill strDestination
End If

Set wbknew = Nothing
Set wksnew = Nothing

ActiveWorkbook. SaveAs Filename:=strDe stination, _
FileFormat:=xlN ormal, Password:="", WriteResPasswor d:="",
ReadOnlyRecomme nded:=False, CreateBackup:=F alse

If MsgBox("Do you want to sent this Travel Report now", vbYesNo,
"Send?") = vbYes Then

If appExcel.MailSy stem <> xlNoMailSystem Then

strRecipients = InputBox("Enter the Email address for the
person receiving this Travel Report.", "Enter Recipient.")

If Not IsNull(Nz(strRe cipients)) Then

appExcel.Dialog s(xlDialogSendM ail).Show
arg1:=strRecipi ents, Arg2:="Travel Report for the month of " &
Forms!frm_Enter _Travel_Reports !cbo_Exp_Month

End If

Else

MsgBox "No Email system is available on this PC", , "No Email."

End If

End If

ActiveWorkbook. Close
appExcel.Quit
Set appExcel = Nothing

rstTravel.Close
dbLocal.Close

Exit Function

eh_ExportTravel Report:
ExportTravelRep ort = False
End Function

Sub SetFont(booBold As Boolean, booItal As Boolean, intSize As Integer,
Optional strFont As String)

With Selection.Font
.Bold = booBold
.Italic = booItal
.Name = IIf(IsMissing(s trFont), "Arial", strFont)
.Size = intSize
End With

End Sub

Sub SetInteriorBord er()
With Selection.Borde rs(xlInsideVert ical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeLeftBord er()
With Selection.Borde rs(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeRightBor der()
With Selection.Borde rs(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeTopBorde r()
With Selection.Borde rs(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeBottomBo rder()
With Selection.Borde rs(xlEdgeBottom )
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Function WriteHeader(str Channel As String, introw As Integer, wksnew As
Worksheet) As Integer

'creates the header for each Channel
wksnew.Cells(in trow, 1) = strChannel
wksnew.Cells(in trow, 1).Select
Call SetFont(True, True, 10)
wksnew.Cells(in trow, 1).Select
Selection.Horiz ontalAlignment = xlLeft

introw = introw + 1

'enter headings
wksnew.Cells(in trow, 1) = "BSB"
wksnew.Cells(in trow, 2) = "CC"
wksnew.Cells(in trow, 3) = "Type"
wksnew.Cells(in trow, 4) = "Invoice Reference"
wksnew.Cells(in trow, 5) = "Passenger"
wksnew.Cells(in trow, 6) = "Owing Value"
wksnew.Cells(in trow, 7) = "Coupon Routing"
wksnew.Cells(in trow, 8) = "Class Used"
wksnew.Cells(in trow, 9) = "Airline Used"
wksnew.Cells(in trow, 10) = "Depature Date"

'format headings
wksnew.Range(Ce lls(introw, 1), Cells(introw, 10)).Select
Call SetFont(True, False, 10)
Call SetEdgeLeftBord er
Call SetEdgeRightBor der
Call SetEdgeTopBorde r
Call SetEdgeBottomBo rder

WriteHeader = introw + 1

End Function
Sub WriteFooter(int row As Integer, wksnew As Worksheet, intStartRow As
Integer)

'writes and formats the subtotals for each Channel
introw = introw + 1
wksnew.Cells(in trow, 5) = "Sub Total"
wksnew.Cells(in trow, 5).Select
Call SetFont(True, False, 10)
wksnew.Cells(in trow, 6).Value = "=Sum(F" & intStartRow & ":F" &
introw - 2 & ")"
wksnew.Cells(in trow, 5).Select
Call SetFont(True, False, 10)
Selection.Numbe rFormat = "$##,##0"

End Sub
Sub SetColumnWidths ()

Columns("A:A"). ColumnWidth = 7.57
Columns("B:B"). ColumnWidth = 4.29
Columns("C:C"). ColumnWidth = 7.43
Columns("D:D"). ColumnWidth = 18
Columns("E:E"). ColumnWidth = 26.86
Columns("F:F"). ColumnWidth = 12.71
Columns("G:G"). ColumnWidth = 19.57
Columns("H:H"). ColumnWidth = 10.86
Columns("I:I"). ColumnWidth = 11.14
Columns("J:J"). ColumnWidth = 18.57
Columns("A:J"). Select
Selection.Horiz ontalAlignment = xlCenter

End Sub

Sub WriteComments()

Range("G6").Sel ect
Range("G6").Add Comment
Range("G6").Com ment.Visible = False
Range("G6").Com ment.Text Text:= _
"MEL = Melbourne" & Chr(10) & "SYD = Sydney" & Chr(10) & "CBR =
Canberra" & Chr(10) & "ADL = Adelaide"

Range("H6").Sel ect
Range("H6").Add Comment
Range("H6").Com ment.Visible = False
Range("H6").Com ment.Text Text:= _
"Y = Qantas full economy" & Chr(10) & "B = Qantas 5 day advance" &
Chr(10) & "V = Qantas 14 Day"
Range("H6").Com ment.Shape.Heig ht = 50
Range("H6").Com ment.Shape.Widt h = 150

Range("I6").Sel ect
Range("I6").Add Comment
Range("I6").Com ment.Visible = False
Range("I6").Com ment.Text Text:= _
"QF = Qantas Airways" & Chr(10) & "UA = United Airlines" & Chr(10)
& "CO = Continental Airlines" & Chr(10) & "BA = British Airways"
Range("I6").Com ment.Shape.Heig ht = 50
Range("I6").Com ment.Shape.Widt h = 150
End Sub
Nov 13 '05 #3
I am having a similar problem. I have HUGE database, millions of
records, I need a large sum of them in Excel. Because one spreadsheet
in excel can only hold 65,536 rows of data I am forced to use multiple
spreadsheets. I have written a macro in access to select which ever
65,536 rows of data in need. I thought that would be the hard part...I
was wrong. Now I need this macro (in access) to copy the selected
rows, then I could use a macro in excel to paste them. If you could
help me past this problem, I will try my best to help you.
Nov 13 '05 #4
Hi,

Your programming problem is in the Excel universe. I'd post in relevant
Excel newsgroups so solve the problem you posted. Once you can do it in
Excel using VBA you can then copy the code into Access VBA and continue it
until you have the functionality you want.

Microsoft.publi c.excel.program ming etc.

HTH
--
-Larry-
--

"PC Datasheet" <no****@nospam. spam> wrote in message
news:P8******** *********@newsr ead3.news.atl.e arthlink.net...
Export your data into a standard worksheet and in your pre-designed excel
worksheet use formulas to get the data from that worksheet.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Jonny" <jo**********@y ahoo.com> wrote in message
news:14******** *************** ***@posting.goo gle.com...
Hello,

I have created a button on my form which when pressed does the
following :

1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.

However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
if I could get the data to populate a pre-designed excel worksheet.

would anyone be able to help me do this please ?

Thanks,

J.


Nov 13 '05 #5
"Mr. Smith" <Mr.Smith@Large > wrote in message news:<40******* *************** *@news.syd.swif tdsl.com.au>...
Jonny wrote:
Hello,

I have created a button on my form which when pressed does the
following :

1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.

However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
if I could get the data to populate a pre-designed excel worksheet.

would anyone be able to help me do this please ?

Thanks,

J.

This has just one problem in that you can only run it once and then you
have to restart Access before you can run it again (OK for weekly or
daily reports but not if you're exporting all day) due to some glitch
I've not been able to figure out yet.

It has all the formating bits in it you'll want and methods to use to
write Spreadhseets any way you want. it includes writing headers and
footers, set Window Zoom, settin gridlines and Row/Column headings on &
off formating cells and even adding comments to cells.

Hope this helps

Option Compare Database
Option Explicit
Function ExportTravelRep ort(strDestinat ion As String) As Boolean
'On Error GoTo eh_ExportTravel Report

Dim dbLocal As Database
Dim rstTravel As Recordset
Dim intCurrTask As Integer
Dim wbknew As Excel.Workbook, wksnew As Excel.Worksheet
Dim appExcel As New Excel.Applicati on
Dim strRange As String
Dim strCurrChannel As String
Dim strRecipients As String
Dim introw As Integer
Dim intStartRow As Integer

ExportTravelRep ort = True

'open data table
Set dbLocal = CurrentDb()
Set rstTravel = dbLocal.OpenRec ordset("qry_Tra vel_Report_Outp ut",
dbOpenSnapshot)

'set up Workbook
Set wbknew = appExcel.Workbo oks.Add
Set wksnew = wbknew.Workshee ts.Add
appExcel.Visibl e = True

'write Legend
wksnew.Cells(1, 7) = "Y = Qantas full economy"
wksnew.Cells(2, 7) = "B = Qantas 5 day advance purchase economy"
wksnew.Cells(3, 7) = "V = Qantas 14 day advance purchase economy"
wksnew.Cells(4, 7) = "H = Qantas 21 day advance purchase economy"
wksnew.Cells(5, 7) = "P = Qantas First Class"
wksnew.Cells(1, 10) = "M = Special domestic"
wksnew.Cells(2, 10) = "J = Business Class"
wksnew.Cells(3, 10) = "D = Discount Business Class"
wksnew.Cells(4, 10) = "F = First Class other"

Call SetColumnWidths
Call WriteComments

rstTravel.MoveF irst
introw = 5
Do While Not rstTravel.EOF

strCurrChannel = Nz(rstTravel!Ch annelName, "unknown")
introw = WriteHeader(str CurrChannel, introw, wksnew)
intStartRow = introw

Do While rstTravel!Chann elName = strCurrChannel

'write record
wksnew.Cells(in trow, 1) = rstTravel!BSB
wksnew.Cells(in trow, 2) = rstTravel!CC
wksnew.Cells(in trow, 3) = rstTravel!Type
wksnew.Cells(in trow, 4) = rstTravel!Refer ence
wksnew.Cells(in trow, 5) = rstTravel!Passe nger
wksnew.Cells(in trow, 6) = rstTravel!Value
wksnew.Cells(in trow, 7) = rstTravel!Coupo nRouting
wksnew.Cells(in trow, 8) = rstTravel!Class Used
wksnew.Cells(in trow, 9) = rstTravel!Airli neUsed
wksnew.Cells(in trow, 10) = CStr(Format(rst Travel!DDate,
"dd/mmm/yyyy"))

wksnew.Range(Ce lls(introw, 1), Cells(introw, 10)).Select
Call SetFont(False, False, 8)
Call SetInteriorBord er
Call SetEdgeLeftBord er
Call SetEdgeRightBor der
Call SetEdgeTopBorde r
Call SetEdgeBottomBo rder
wksnew.Cells(in trow, 6).Select
Selection.Numbe rFormat = "$##,##0"
wksnew.Cells(in trow, 10).Select
introw = introw + 1
rstTravel.MoveN ext

If rstTravel.EOF Then Exit Do

Loop

Call WriteFooter(int row, wksnew, intStartRow)
introw = introw + 1

Loop

With ActiveWindow
.Zoom = 100
.DisplayGridlin es = False
.DisplayHeading s = False
End With
wksnew.Range("G 1:J5").Select
Selection.Horiz ontalAlignment = xlLeft
Call SetFont(True, False, 6)

If Dir(strDestinat ion) = Right(strDestin ation, 22) Then
Kill strDestination
End If

Set wbknew = Nothing
Set wksnew = Nothing

ActiveWorkbook. SaveAs Filename:=strDe stination, _
FileFormat:=xlN ormal, Password:="", WriteResPasswor d:="",
ReadOnlyRecomme nded:=False, CreateBackup:=F alse

If MsgBox("Do you want to sent this Travel Report now", vbYesNo,
"Send?") = vbYes Then

If appExcel.MailSy stem <> xlNoMailSystem Then

strRecipients = InputBox("Enter the Email address for the
person receiving this Travel Report.", "Enter Recipient.")

If Not IsNull(Nz(strRe cipients)) Then

appExcel.Dialog s(xlDialogSendM ail).Show
arg1:=strRecipi ents, Arg2:="Travel Report for the month of " &
Forms!frm_Enter _Travel_Reports !cbo_Exp_Month

End If

Else

MsgBox "No Email system is available on this PC", , "No Email."

End If

End If

ActiveWorkbook. Close
appExcel.Quit
Set appExcel = Nothing

rstTravel.Close
dbLocal.Close

Exit Function

eh_ExportTravel Report:
ExportTravelRep ort = False
End Function

Sub SetFont(booBold As Boolean, booItal As Boolean, intSize As Integer,
Optional strFont As String)

With Selection.Font
.Bold = booBold
.Italic = booItal
.Name = IIf(IsMissing(s trFont), "Arial", strFont)
.Size = intSize
End With

End Sub

Sub SetInteriorBord er()
With Selection.Borde rs(xlInsideVert ical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeLeftBord er()
With Selection.Borde rs(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeRightBor der()
With Selection.Borde rs(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeTopBorde r()
With Selection.Borde rs(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Sub SetEdgeBottomBo rder()
With Selection.Borde rs(xlEdgeBottom )
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub

Function WriteHeader(str Channel As String, introw As Integer, wksnew As
Worksheet) As Integer

'creates the header for each Channel
wksnew.Cells(in trow, 1) = strChannel
wksnew.Cells(in trow, 1).Select
Call SetFont(True, True, 10)
wksnew.Cells(in trow, 1).Select
Selection.Horiz ontalAlignment = xlLeft

introw = introw + 1

'enter headings
wksnew.Cells(in trow, 1) = "BSB"
wksnew.Cells(in trow, 2) = "CC"
wksnew.Cells(in trow, 3) = "Type"
wksnew.Cells(in trow, 4) = "Invoice Reference"
wksnew.Cells(in trow, 5) = "Passenger"
wksnew.Cells(in trow, 6) = "Owing Value"
wksnew.Cells(in trow, 7) = "Coupon Routing"
wksnew.Cells(in trow, 8) = "Class Used"
wksnew.Cells(in trow, 9) = "Airline Used"
wksnew.Cells(in trow, 10) = "Depature Date"

'format headings
wksnew.Range(Ce lls(introw, 1), Cells(introw, 10)).Select
Call SetFont(True, False, 10)
Call SetEdgeLeftBord er
Call SetEdgeRightBor der
Call SetEdgeTopBorde r
Call SetEdgeBottomBo rder

WriteHeader = introw + 1

End Function
Sub WriteFooter(int row As Integer, wksnew As Worksheet, intStartRow As
Integer)

'writes and formats the subtotals for each Channel
introw = introw + 1
wksnew.Cells(in trow, 5) = "Sub Total"
wksnew.Cells(in trow, 5).Select
Call SetFont(True, False, 10)
wksnew.Cells(in trow, 6).Value = "=Sum(F" & intStartRow & ":F" &
introw - 2 & ")"
wksnew.Cells(in trow, 5).Select
Call SetFont(True, False, 10)
Selection.Numbe rFormat = "$##,##0"

End Sub
Sub SetColumnWidths ()

Columns("A:A"). ColumnWidth = 7.57
Columns("B:B"). ColumnWidth = 4.29
Columns("C:C"). ColumnWidth = 7.43
Columns("D:D"). ColumnWidth = 18
Columns("E:E"). ColumnWidth = 26.86
Columns("F:F"). ColumnWidth = 12.71
Columns("G:G"). ColumnWidth = 19.57
Columns("H:H"). ColumnWidth = 10.86
Columns("I:I"). ColumnWidth = 11.14
Columns("J:J"). ColumnWidth = 18.57
Columns("A:J"). Select
Selection.Horiz ontalAlignment = xlCenter

End Sub

Sub WriteComments()

Range("G6").Sel ect
Range("G6").Add Comment
Range("G6").Com ment.Visible = False
Range("G6").Com ment.Text Text:= _
"MEL = Melbourne" & Chr(10) & "SYD = Sydney" & Chr(10) & "CBR =
Canberra" & Chr(10) & "ADL = Adelaide"

Range("H6").Sel ect
Range("H6").Add Comment
Range("H6").Com ment.Visible = False
Range("H6").Com ment.Text Text:= _
"Y = Qantas full economy" & Chr(10) & "B = Qantas 5 day advance" &
Chr(10) & "V = Qantas 14 Day"
Range("H6").Com ment.Shape.Heig ht = 50
Range("H6").Com ment.Shape.Widt h = 150

Range("I6").Sel ect
Range("I6").Add Comment
Range("I6").Com ment.Visible = False
Range("I6").Com ment.Text Text:= _
"QF = Qantas Airways" & Chr(10) & "UA = United Airlines" & Chr(10)
& "CO = Continental Airlines" & Chr(10) & "BA = British Airways"
Range("I6").Com ment.Shape.Heig ht = 50
Range("I6").Com ment.Shape.Widt h = 150
End Sub

Thank you very much for this - I'll have a look at it.
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5031
by: Matt | last post by:
I have an ASP page that calls ASP routines that I created that execute a database query and return the results to a recordset. I then iterate through the recordset and display the data in a table. Before I iterate through the recordset I instruct the browser that the content type is Excel using the following line: (Response.ContentType = "application/vnd.ms-excel") This works fine with Excel 2003 but with older versions (I tested Excel...
6
4062
by: Elena | last post by:
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. Thank you, Elena
4
15010
by: Jiro Hidaka | last post by:
Hello, I would like to know of a fast way to export data source data into an Excel sheet. I found a way from C# Corner(Query Tool to Excel using C# and .NET) which is a neat little way of exporting dataset data to an excel using the Excel COM object. This works fine but the problem is its pretty darn slow when exporting large
13
13231
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=ABC.xls") HttpContext.Current.Response.Write(strHTML) HttpContext.Current.Response.End() However when the user tries to save it the Default File Type is Web Page(*.htm; *.html)
1
7205
by: JawzX01 | last post by:
Hello All, First, thank you for any help you can provide. I'm trying to do a simple export to excel. I've used the classic code that is all over the internet, and of course it worked without a problem. The problem is that I want to add text above the data grid in the excel sheet. The text already exists on the web page in various panels (there is different text depending on the parameters of the datagrid
1
9777
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping to export two Tables (or queries...not sure which to use - they both seem to have the same data) in...
1
10496
by: CoolFactor | last post by:
MY CODE IS NEAR THE BOTTOM I want to export this Access query into Excel using a command button on an Access form in the following way I describe below. Below you will find the simple query I am trying to export to Excel using a command in an Access Form. RowID strFY AccountID CostElementWBS 1 2008 1 7 2 2008 1 7 I want to...
7
28899
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can actually do something more with. This code shows you how to display data from your database and then how to give that data to the user in the form of a useable Excel spreadsheet which they can then take away and play with themselves. The way I have shown...
3
7155
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this file but save it as an excel file. The data in this excel file will be imported into an Access database. The
2
6413
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the method.... it creates 6 sheets # region Namespaces using System;
0
8820
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9100
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9044
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3174
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.