Rabu, 28 Januari 2015

Re: [MS_AccessPros] Error controlling Excel from Access

 

Hi Adam,

John is right -- you need to reference the desired sheet, not the Excel application.

The Excel macro recorder does not reference ActiveSheet since that is the default.  However, when you write automation code from Access, you DO need to reference the sheet.  Also, keep in mind, you can reference ANY sheet, not just the active one :)  It is better NOT to use SELECTION and most times not necessary either.  Exceptions include Freeze and Zoom.

also, .Application would not be right anyway ... the prefaced . means that code is between WITH <object> and End With.  There is nothing higher than application.

look at the automation code  for Excel from Access posted in the download here:


Warm Regards,
Crystal

~ have an awesome day ~



On Wednesday, January 28, 2015 2:58 PM, "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:




Adam-

Why did you add the .Application?  If it works in Excel, try it in Access without that.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Jan 28, 2015, at 10:31 PM, runuphillracing@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

John,

You mean you don't know all, see all? :)

The VB code runs properly in Excel. I created and tested it there, then just copied and pasted into Access, adding the .Application.

I have the MS Access Package Solution Wizard 2010 COM, ACCESSDE.dll, add in. I assume that includes the Excel library loaded because other lines work. It's just those few lines that didn't work that I included here.

I'll see if Crystal comes up with something. I have an off list convo going on with her. Us Coloradans have to stick together.

Thanks





__._,_.___

Posted by: Crystal <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)

.

__,_._,___

Tidak ada komentar:

Posting Komentar