Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / April 2006

Tip: Looking for answers? Try searching our database.

error 1004

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Warren Siu - 10 Apr 2006 03:47 GMT
I wrote a procedure attached on a bottom of a access form which is for
selecting some data and exporting them to excel and plotting a chart. The
procedure work alternatively...that it work for the first time, then an error
of 1004 of Method 'ActiveChart' of object '_Globel' failed for the second
time then it work for the third time and so on. The below is the procedure
fragment. Can any one give me an idea?

Dim oChart As Chart

Set oSheet2 = oBook.Worksheets(2)
   oSheet2.Select
   oSheet2.Name = "Chart"
   oSheet2.Range("A1").Select
   Set oChart = oBook.Charts.Add
       
   ActiveChart.ChartType = xlLineMarkers " the error was highlight there.
RoyVidar - 10 Apr 2006 09:18 GMT
Warren Siu wrote in message
<4DA559F7-C43A-4050-B427-4EF4E95131E4@microsoft.com> :
> I wrote a procedure attached on a bottom of a access form which is
> for  selecting some data and exporting them to excel and plotting a
[quoted text clipped - 14 lines]
>     ActiveChart.ChartType = xlLineMarkers " the error was highlight
> there.

The most likely culprit, is the non qualified reference to the active
chart. It will need to be qualified through the relevant excel
objects in stead. I don't have much knowledge about these kind of
Excel objects, but I'd quess the newly created chart object could
be used

    Set oChart = oBook.Charts.Add

    oChart.ChartType = xlLineMarkers

All references and usage of Excel objects, methods and properties need
to be performed by "proper" referencing - i e - for instance through
the
object variables used.

Signature

Roy-Vidar

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.