Advertisement

08.03.2007 at 11:47AM PDT, ID: 22740850
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.4

Manage Excel from VBA

Asked by Buck_Beasom in Microsoft Access Database, Visual Basic Programming, Microsoft Excel Spreadsheet Software

Tags: ,

Using Access 2003 and Excel

I've been around the block on this a couple of times (some postings on this site.) I have gotten to the point where I can populate a single Excel worksheet with data (simply by using ".Cell( intR, intC) = SOMEDATA, where intR and intC are the row and column references.)

But the minute I move into trying to do other Excel things - like copy and paste or underline - I run into problems. What's worse, some of what I try works and other stuff - which intuitively seems no different - doesn't. Example:

Private Sub Run_Click()
    Dim objExcel As Object
    Dim objSheet As Object
    Dim objRange As Object
   
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    objExcel.DisplayAlerts = False
   
    objExcel.Workbooks.Open "C:\Documents and Settings\wbeasom\Buck\PowerProject\Velna1.xls"
-->    objExcel.Workbooks.Sheet("Sheet1").Activate
    '(Gives "Object Doesn't Support This Property Or Method)
   
    With objExcel.ActiveSheet
        .Range("A2,A4").Select
-->        .Selection.Copy
        '(Gives Same Error)
        .Range("A3").Select
        .Paste
    End With
   
End Sub

I can't seem to select the sheet I want.
The first range command works, but the ".Selection.Copy" also blows up (Object doesn't support . . ."

When I try this:

With objExcel.ActiveSheet
        .Range("A2,C2").Select
        .Copy
        .Range("A3,C3").Select
        .Paste
End With

The copy seems to work (at least it doesn't blow up) but the second .Range command gives "Select Method of Range Class Failed."

I'm still trying to figure out how to do things like underline, change row height and column width and so forth.

Can anyone provide some guidance here or is there a resource of code snippets that will point me in the right direction. It seems that once I get some basic syntax straight I should be able to manipulate the Excel to my heart's content, but since I am using "Late Binding" it's pretty obvious that I can't just cut code out of Excel macros and use it in VBA.

Thanks in advance.
Start Free Trial
[+][-]08.03.2007 at 11:50AM PDT, ID: 19627532

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 11:52AM PDT, ID: 19627553

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 11:53AM PDT, ID: 19627568

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 11:55AM PDT, ID: 19627579

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 12:03PM PDT, ID: 19627629

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 12:09PM PDT, ID: 19627667

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 05:53PM PDT, ID: 19629408

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.03.2007 at 06:11PM PDT, ID: 19629449

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.04.2007 at 03:25AM PDT, ID: 19630459

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.04.2007 at 07:16AM PDT, ID: 19630990

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.06.2007 at 07:20AM PDT, ID: 19638482

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.07.2007 at 04:39AM PDT, ID: 19644736

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Access Database, Visual Basic Programming, Microsoft Excel Spreadsheet Software
Tags: excel, vba
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.07.2007 at 06:51AM PDT, ID: 19645738

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.19.2007 at 06:00PM PDT, ID: 19727618

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.17.2007 at 08:43AM PST, ID: 20304678

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628