Solved

Work with Excel Spreadsheet from within Access

Posted on 2002-07-16
5
391 Views
Last Modified: 2008-02-26
I know how to export a query out to Excel in VBA.

After the spreadsheet is created, I want to programmatically do the following:

1)  Create a "Split" (panes) in the spreadsheet.  Coordinates would be at cell A4.

2)  Freeze the panes.

This would be the equivalent of choosing Window |Split in Excel, positioning the split to cell A4, then choosing Window | Freeze Panes.
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 7158352
Even better, a few good web sites that have tutorials on this kind of thing, and the layout of the Excel object model.  Then I could help myself in the future.

Thanks!
0
 
LVL 3

Accepted Solution

by:
pbryan earned 50 total points
ID: 7158664
what I find easiest is to create a macro in excel, and then use that code in access...

In access you have to add a reference to the Excel application or in code use

set myexcel=createobject("Excel.application")

then all you usually have to do is add myexcel. infront of all you lines from the excel macro

----
have a look at http://www.mvps.org/dmcritchie/excel/excel.htm
0
 
LVL 12

Expert Comment

by:James Elliott
ID: 7159072
Something like this: (Make sure your excel library is referenced in your VB editor)

Dim xlapp As Object

Set xlapp = CreateObject("Excel.Application")

Workbooks("c:\BOOK1.XLS").Worksheets("Sheet1").Activate
With ActiveWindow
    .SplitColumn = 1
    .SplitRow = 2
    .Freezepanes = true
End With

Thanks

Jell

0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 7159888
I ended up creating the macro.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 7160691
   Dim objExcel As New Excel.Application

    objExcel.ActiveWorkbook.Save
   
    objExcel.Workbooks.Open strXLSName

    objExcel.Quit
   
     
    'DOES NOT CLOSE EXCEL!!!
    Set objExcel = Nothing
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question