Re: A problem while exporting to Excel - URGENT please

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: dilish (dilish_at_covisible.com)
Date: 03/27/04


Date: Sat, 27 Mar 2004 17:58:28 +0530


     Dim xclApp As Object 'Excel.Application
    Dim xclBk As Object 'Excel.Workbook
    Dim xclSht As Object 'Excel.Work***

    Set xclApp = CreateObject("Excel.Application") 'New Excel.Application
    'Set xclBk = CreateObject("Excel.Workbook")
    'Set xclSht = CreateObject("Excel.Work***")
    Set xclBk = xclApp.Workbooks.Open("C:\New.xls") 'Path of an existing
Excel File

    Set xclSht = xclBk.Worksheets("Sheet1") 'Sheet on the Existing File

    Dim i As Integer
    'As this loop puts in the values u can specify the records fetched from
the Database and the Corresponding Column Headers.
    For i = 1 To 10
            xclSht.Cells(4, i).Value = "new value"
    Next

    xclBk.Save
    xclBk.Activate
    xclApp.Visible = True
    xclApp.Quit
    Set xclApp = Nothing

'Just try the Code and if it doesnt work then let me know.I have used VB6 to
write this.
Regards
Dilish

"Learner" <wantnospam@email.com> wrote in message
news:OMCcKl#EEHA.1240@TK2MSFTNGP10.phx.gbl...
> Hi Dilish,
>
> I'll be very grateful if you can provide me with the code.
>
> Thanks.
>
> > Hello,
> > I am not very sure how to use Crystal report but surely u can create a
Excel
> > object (Bypassing the Crystal report object) and then export the data
> > row/column wise from your VB application itself.If you need i can supply
the
> > code for the same.
> >
> > Regards
> > Dilish
> >
> > "Learner" <wantnospam@email.com> wrote in message
> > news:#rNEAl8EEHA.3040@TK2MSFTNGP12.phx.gbl...
> > > Hi,
> > >
> > > We have a reporting application which simply is a VB 6 based menu
driven
> > > application to launch various reports (developed with Crystal Reports
> > > 8.5).
> > >
> > > Here's the problem:
> > > For a few of these reports, the purpose is that after the user has
> > > passed a few parameters (via a form developed in VB) the resultant
data
> > > should be simply exported to Excel in application mode I.e. the data
is
> > > exported to Excel and Excel is opened with the exported data. The
> > > problem which is being faced is that we are unable to BY-PASS the
> > > crystal report which gets displayed first. And from there the user has
> > > to export the data to Excel. I mean it works but the
opening/displaying
> > > of the Crystal Reports in an unnecessary intermediate step which is of
> > > no use for the user and besides, also take time.
> > >
> > > Is there any way to by-pass this and solve the problem.
> > >
> > > I'll appreciate a urgent reply.
> > >
> > > Many thanks in advance.
> >
> >
> >


Quantcast