Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Work with Excel Spreadsheet from within Access

Posted on 2002-07-16
5
Medium Priority
?
412 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

618 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