PC Review


Reply
Thread Tools Rate Thread

Creating an Excel Sheet from an Access Ap.

 
 
Salvador M
Guest
Posts: n/a
 
      2nd Sep 2003
Hi, I'm trying to create an Excel Sheet from an Access
Aplication. I already have the info in my prog. now I would
like to write the column header plus the columns data.
Is there any way way to create an Excel file, access an
especific cell write the data of that cell and after
finishing close the file?

Your help will be appreciated

Salvador
 
Reply With Quote
 
 
 
 
Ken Snell
Guest
Posts: n/a
 
      2nd Sep 2003
Here's some sample code for opening an EXCEL workbook:

Public Sub TestMacroRun()
Dim xlx As Object, xlw As Object, xls As Object, xlc As Object
Set xlx = CreateObject("excel.application")
Set xlw = xlx.workbooks.Open("C:\Filename.xls")
Set xls = xlw.Worksheets("WorksheetName")
Set xlc = xls.Range("A1")
' put code here to write into the cells etc.
' .
' .
' .
Set xlc = Nothing
Set xls = Nothing
xlw.Save
xlw.Close False
Set xlw = Nothing
xlx.Quit
Set xlx = Nothing
End Sub

--
Ken Snell
<MS ACCESS MVP>

"Salvador M" <(E-Mail Removed)> wrote in message
news:0a3401c370e0$d224d400$(E-Mail Removed)...
> Hi, I'm trying to create an Excel Sheet from an Access
> Aplication. I already have the info in my prog. now I would
> like to write the column header plus the columns data.
> Is there any way way to create an Excel file, access an
> especific cell write the data of that cell and after
> finishing close the file?
>
> Your help will be appreciated
>
> Salvador



 
Reply With Quote
 
Salvador Michel
Guest
Posts: n/a
 
      2nd Sep 2003
Thanks Ken for your Response, but....
1) How do you write to a cell ?
2) Does the .range property makes you access an especific
cell ?
3) How can I look for other properties of the worksheet,
because when I'm writing to the access editor and put
the period I don't get a Member list of that object
I have already activated the Microsoft Excel 9.0 Object
Library.

Looking forward for you answer

Salvador


>-----Original Message-----
>Here's some sample code for opening an EXCEL workbook:
>
>Public Sub TestMacroRun()
>Dim xlx As Object, xlw As Object, xls As Object, xlc As

Object
>Set xlx = CreateObject("excel.application")
>Set xlw = xlx.workbooks.Open("C:\Filename.xls")
>Set xls = xlw.Worksheets("WorksheetName")
>Set xlc = xls.Range("A1")
>' put code here to write into the cells etc.
>' .
>' .
>' .
>Set xlc = Nothing
>Set xls = Nothing
>xlw.Save
>xlw.Close False
>Set xlw = Nothing
>xlx.Quit
>Set xlx = Nothing
>End Sub
>
>--
> Ken Snell
><MS ACCESS MVP>
>
>"Salvador M" <(E-Mail Removed)> wrote in message
>news:0a3401c370e0$d224d400$(E-Mail Removed)...
>> Hi, I'm trying to create an Excel Sheet from an Access
>> Aplication. I already have the info in my prog. now I

would
>> like to write the column header plus the columns data.
>> Is there any way way to create an Excel file, access an
>> especific cell write the data of that cell and after
>> finishing close the file?
>>
>> Your help will be appreciated
>>
>> Salvador

>
>
>.
>

 
Reply With Quote
 
Ken Snell
Guest
Posts: n/a
 
      3rd Sep 2003
Sorry. I was assuming that you were familiar with VBA code for EXCEL.

To write to a specific cell, you use the .Range property of a Worksheet. For
example, in the code I had given you, if you wanted to write the value 12 to
cell A1 on the xls worksheet:
xls.Range("A1").Value = 12

You can get the properties and methods of a worksheet if you open EXCEL and
then open Visual Basic Editor, then open the Help file. That gives you info
about EXCEL's objects, their properties and methods, etc. If you're very
unfamiliar with EXCEL VBA code, I recommend that you begin in EXCEL and then
copy the code from there into ACCESS module; it'll get you closer to where
you want to be.

Alternatively, if you just want to see the properties and methods, you can
use the Object Browser in VBE in ACCESS to see what they are. That won't
tell you what they do, though.
--
Ken Snell
<MS ACCESS MVP>

"Salvador Michel" <(E-Mail Removed)> wrote in message
news:09c701c37186$83488470$(E-Mail Removed)...
> Thanks Ken for your Response, but....
> 1) How do you write to a cell ?
> 2) Does the .range property makes you access an especific
> cell ?
> 3) How can I look for other properties of the worksheet,
> because when I'm writing to the access editor and put
> the period I don't get a Member list of that object
> I have already activated the Microsoft Excel 9.0 Object
> Library.
>
> Looking forward for you answer
>
> Salvador
>
>
> >-----Original Message-----
> >Here's some sample code for opening an EXCEL workbook:
> >
> >Public Sub TestMacroRun()
> >Dim xlx As Object, xlw As Object, xls As Object, xlc As

> Object
> >Set xlx = CreateObject("excel.application")
> >Set xlw = xlx.workbooks.Open("C:\Filename.xls")
> >Set xls = xlw.Worksheets("WorksheetName")
> >Set xlc = xls.Range("A1")
> >' put code here to write into the cells etc.
> >' .
> >' .
> >' .
> >Set xlc = Nothing
> >Set xls = Nothing
> >xlw.Save
> >xlw.Close False
> >Set xlw = Nothing
> >xlx.Quit
> >Set xlx = Nothing
> >End Sub
> >
> >--
> > Ken Snell
> ><MS ACCESS MVP>
> >
> >"Salvador M" <(E-Mail Removed)> wrote in message
> >news:0a3401c370e0$d224d400$(E-Mail Removed)...
> >> Hi, I'm trying to create an Excel Sheet from an Access
> >> Aplication. I already have the info in my prog. now I

> would
> >> like to write the column header plus the columns data.
> >> Is there any way way to create an Excel file, access an
> >> especific cell write the data of that cell and after
> >> finishing close the file?
> >>
> >> Your help will be appreciated
> >>
> >> Salvador

> >
> >
> >.
> >



 
Reply With Quote
 
Ken Snell
Guest
Posts: n/a
 
      4th Sep 2003
An EXCEL 97 and higher spreadsheet can have up to 256 columns and 65536
rows.

You should not have any problem writing into row 356.

You'll need to provide more information about the code that you're using and
the setup of the spreadsheet before I could venture a suggestion about this
problem.

--
Ken Snell
<MS ACCESS MVP>

"Salvador Michel" <(E-Mail Removed)> wrote in message
news:13ed01c37272$caf073e0$(E-Mail Removed)...
> Ken, Thanks a lot
> Your information really help my app is working.
>
> Another question, the worksheet that I crated is 186
> columns wide and when it tries to write on line 356 it
> freezes. Do you know why or there are other commands I
> need to use to maximize the number of lines I can have.
>
> Thanks for everything
>
> Salvador
>
> >-----Original Message-----
> >Sorry. I was assuming that you were familiar with VBA

> code for EXCEL.
> >
> >To write to a specific cell, you use the .Range property

> of a Worksheet. For
> >example, in the code I had given you, if you wanted to

> write the value 12 to
> >cell A1 on the xls worksheet:
> > xls.Range("A1").Value = 12
> >
> >You can get the properties and methods of a worksheet if

> you open EXCEL and
> >then open Visual Basic Editor, then open the Help file.

> That gives you info
> >about EXCEL's objects, their properties and methods, etc.

> If you're very
> >unfamiliar with EXCEL VBA code, I recommend that you

> begin in EXCEL and then
> >copy the code from there into ACCESS module; it'll get

> you closer to where
> >you want to be.
> >
> >Alternatively, if you just want to see the properties and

> methods, you can
> >use the Object Browser in VBE in ACCESS to see what they

> are. That won't
> >tell you what they do, though.
> >--
> > Ken Snell
> ><MS ACCESS MVP>
> >
> >"Salvador Michel" <(E-Mail Removed)> wrote in

> message
> >news:09c701c37186$83488470$(E-Mail Removed)...
> >> Thanks Ken for your Response, but....
> >> 1) How do you write to a cell ?
> >> 2) Does the .range property makes you access an

> especific
> >> cell ?
> >> 3) How can I look for other properties of the worksheet,
> >> because when I'm writing to the access editor and put
> >> the period I don't get a Member list of that object
> >> I have already activated the Microsoft Excel 9.0

> Object
> >> Library.
> >>
> >> Looking forward for you answer
> >>
> >> Salvador
> >>
> >>
> >> >-----Original Message-----
> >> >Here's some sample code for opening an EXCEL workbook:
> >> >
> >> >Public Sub TestMacroRun()
> >> >Dim xlx As Object, xlw As Object, xls As Object, xlc As
> >> Object
> >> >Set xlx = CreateObject("excel.application")
> >> >Set xlw = xlx.workbooks.Open("C:\Filename.xls")
> >> >Set xls = xlw.Worksheets("WorksheetName")
> >> >Set xlc = xls.Range("A1")
> >> >' put code here to write into the cells etc.
> >> >' .
> >> >' .
> >> >' .
> >> >Set xlc = Nothing
> >> >Set xls = Nothing
> >> >xlw.Save
> >> >xlw.Close False
> >> >Set xlw = Nothing
> >> >xlx.Quit
> >> >Set xlx = Nothing
> >> >End Sub
> >> >
> >> >--
> >> > Ken Snell
> >> ><MS ACCESS MVP>
> >> >
> >> >"Salvador M" <(E-Mail Removed)> wrote in

> message
> >> >news:0a3401c370e0$d224d400$(E-Mail Removed)...
> >> >> Hi, I'm trying to create an Excel Sheet from an

> Access
> >> >> Aplication. I already have the info in my prog. now I
> >> would
> >> >> like to write the column header plus the columns

> data.
> >> >> Is there any way way to create an Excel file, access

> an
> >> >> especific cell write the data of that cell and after
> >> >> finishing close the file?
> >> >>
> >> >> Your help will be appreciated
> >> >>
> >> >> Salvador
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
code 'summing' - access query creating an excel-sheet Gerry Microsoft Access VBA Modules 1 24th Feb 2010 08:02 PM
Creating Excel Sheet using VB 2005 mdup Microsoft Excel Programming 2 19th Feb 2010 02:08 PM
I need help creating a formula for an excel sheet jennyandalize Microsoft Excel Worksheet Functions 0 18th Nov 2008 06:31 PM
Creating an Attendance sheet in Access =?Utf-8?B?aXZhbHVtMjE=?= Microsoft Access 5 22nd Jul 2005 07:10 PM
Problems creating Excel sheet Evan T. Basalik Microsoft ASP .NET 0 14th Dec 2003 08:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:45 PM.