Error # 429 Active X Can't Create The Object
Jul 13, 2007
I am having trouble with the following code... I get error # 429 Active X can't create the object...
Dim blnIOpened As Boolean
Err.Number = 0
On Error GoTo failed
blnIOpened = False
Set MyXL = GetObject(, Excel.Application)
failed:
If Err.Number = 429 Then
Set MyXL = CreateObject(Excel.Application)
blnIOpened = True
End If
If Err.Number 429 Then
MsgBox Err.Number
End If
View 9 Replies
ADVERTISEMENT
Oct 11, 2006
I have been trying to create a macro in excel to chart a selection of data and to output the chart on the active sheet where the data was taken (as opposed to a named sheet). So basically, I have about 300 worksheets with data, and I would like to have a button on each page that automatically charts that data when clicked, and outputs the chart to the page where the macro was clicked. However, I have not been able to figure out a relative reference that will allow me to make the LocationasObject reference simply the ActiveSheet as opposed to a specifically named sheet. See my code below, which references an output to a worksheet called "Charts". Right now, all of my charts are outputting to the sheet called "Charts", as opposed to the active sheet.
Sub ConsDiscChart()
ActiveCell.Offset(29, 11).Range("A1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1:B1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Offset(0, -1).Range("A1:C24").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.Location Where:=xlLocationAsObject, Name:="Charts"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
View 5 Replies
View Related
Jan 26, 2010
I am trying to generate excel report output from access by click of a button. Part of the code is as follows:
Dim lngColumn As Long
Dim xlx As Object, xlw As Object, xlc As Object
Dim DBS As DAO.Database
Dim rst As DAO.Recordset
Dim blnEXCEL As Boolean, blnHeaderRow As Boolean
blnEXCEL = False
'If we do not want the first row we set Header to false
blnHeaderRow = False
'Establish an EXCEL application object
On Error Resume Next
Set xlx = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
Set xlx = CreateObject("Excel.Application")
blnEXCEL = True
End If
Err.Clear
I worked on development on a server and worked fine. However when I have moved the code and database to the desktop of mine I am having
the following error in the line
Set xlx = GetObject(, "Excel.Application")
Run-time error '429'
ActiveX component can't create object
View 10 Replies
View Related
Dec 8, 2012
Following bit of code runs fine if placed in Word VBA:
Code:
Public Sub TaskUsageInExcel()
Dim tsk As Task
For Each tsk In Tasks 'Gives RTE 429 when run through Excel
Debug.Print tsk.Name
Next tsk
End Sub
So I referenced 'Microsoft Word 12.0 Object Library' in Excel and ran the code and it gave me this error 429. Noticeable part was, no instance of word was running at that time.
So I modified the code as below:
Code:
Public Sub TaskUsageInExcel2()
Dim wdApp As Word.Application
Dim tsk As Task
[Code]....
View 4 Replies
View Related
Jan 4, 2007
VBScript code snippet below is being used in an ASP page but the call to GetObject never attaches to a running instance of Excel. Since visible property is set to True, I can see the instances accumulate in the TaskBar each time the ASP page is called, so there are obviously instances to attach to.
Dim excelApp
Set excelApp = Server.GetObject(,"Excel.Application")
If (err <> 0) Then
Set excelApp = Server.CreateObject("Excel.Application")
End If
excelApp.UserControl = True
excelApp.Visible = True
excelApp = Nothing
GetObject errors out with the following error: Error - Number:429 Source:Microsoft VBScript runtime error Description:ActiveX component can't create object
View 3 Replies
View Related
Nov 22, 2008
I have a very strange problem in DEBUG mode, because i get this error "Application-defined or object-defined error" when referring to a cell and assigning it a value so it goes to my error handler and i have a Resume Next there. It continues to go through the code whilst continuing to go to the error handler but when i step out of the function it restarts again from the beginning on the called function and then on the second run of my code it seems to WORK!?! So i'm thinking what the hell is going on, it falls over and fails the first time round and works the second time round?
In free-run mode from excel i just get a #VALUE!
View 13 Replies
View Related
Aug 11, 2008
I have some VBA code that in one portion of it an Outlook e-mail is created and the active workbook is attached and sent. This code used to work on Excel & Outlook 2003, but now in Excel & Outlook 2007 I'm getting the error:
Run-time error '429':
ActiveX component can't create object
and is stopping on the line
Set OutApp = GetObject(, "Outlook.Application")
FY If I comment out the Set OutApp... and If OutApp.... lines and uncomment the Set OutApp create object line, I still get the same error.
Dim OutApp As Object
Dim OutMail As Object
Dim SigString As String
Dim Signature As String
'Set OutApp = CreateObject("Outlook.Application")
Set OutApp = GetObject(, "Outlook.Application")
If OutApp Is Nothing Then Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
View 9 Replies
View Related
Aug 30, 2006
I have a basic data table with KPI labels down one side and dates across the top. Using this data table as the series source, I create a number of charts below it with serialised names eg Chart0, Chart1, Chart2, etc. I am attempting to enable the KPI labels so that when a user clicks it, the spreadsheet will navigate to the appropriate chart. I place the name value for the chart object in the cell immediataly to the left of each KPI label (and hide it). This way I know which chart object below is related to which KPI label above. That part works.
I have a Worksheet_SelectionChange() event procedure attached to the charting worksheet. When a user clicks into one of the KPI labels, the event procedure fires and the appropriate chart is activated. The code is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B5:B19")) Is Nothing Then
On Error Resume Next
chtObjName = Range(Target.Address).Offset(0, -1).Range("A1").Value
If Left(chtObjName, 5) = "Chart" Then
ActiveSheet.ChartObjects(chtObjName).Select
If Err.Number <> 0 Then
MsgBox "No such chart exists.", vbCritical, _
"Chart Not Found"
End If
End If
On Error Goto 0
End If
End Sub
View 4 Replies
View Related
Apr 13, 2006
whether I can handle errors in a way that tells me which object caused the error?
For example if a userform has two combobox's and one causes an error, can I return to a message box containing the name of the object (combobox1 or combobox2)?
I have tried returning err.source but I am either not using it correctly or it isn't intended to be used this way.
View 3 Replies
View Related
May 13, 2009
I am having difficulty getting a form to work the way that I would like it to work. I have a form that is used to display questions that my students will be answering. The form also is used to put the answers into a worksheet. I have 2 sheets. Sheet2 has the questions, student answers, and correct answers. Sheet1 is used to indicate correct answers and to keep track of percentage correct. I am fairly new to VB. I have 2 pieces of code that I am going to post. The first one works and the second one doesn't.
This is in the "This Workbook" section and it works.
Option Explicit
Public intNoQ As Integer
Public strNoQ As String
Public NumberofQuestions As Integer
Dim StudentName As String
Dim InputBoxAnswer As String
Public Sub Workbook_Open()
Application.Visible = False 'Hide Excel
Load Questions
Load NumberCorrect
NumberofQuestions = Worksheets("Sheet1").Range("K3").Value
For intNoQ = 1 To NumberofQuestions
strNoQ = VBA.CStr(intNoQ)
If intNoQ = 1 Then
Questions.Controls("QuestionNumberBox").Value = "Question#" & strNoQ
Questions.Controls("QuestionBox").Value = Worksheets("Sheet2").Range("B1").Value
End If
Questions.Controls("CorrectBox" & strNoQ).Visible = True
Questions.Controls("CorrectLabel" & strNoQ).Visible = True
Next intNoQ...............
View 9 Replies
View Related
Mar 5, 2013
I have a relatively complex report that I work with and a worksheet is no longer required. I have deleted the worksheet and reference to it hwoever when running the macro to pull all the data, it gets to the summary of all the data and i get the Run Time Error 1004 Application-defined or object-defined error pop up. ON reviewing it, it is on this line ActiveCell.Offset(0, 0).Range("a1:a" & Range_Height).Select of the below code...
VB:
Sub GetRangeName()
Sheets("TOTAL").Select
[Code].....
use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window.
View 1 Replies
View Related
Apr 26, 2009
I have a simple function below to put in different forumlas in different cells to get stock quotes. When I run this I get runtime error 1004 application-defined or object-defined error. The first formula goes through but vba chokes on the next formula: ActiveCell.Offset(I - 1, 4).Formula = username
View 10 Replies
View Related
Aug 12, 2009
Run-time error '1004' Application-defined or object-defined error. I am trying to use this
View 2 Replies
View Related
Oct 4, 2009
I was trying to use the below code
View 4 Replies
View Related
Aug 17, 2008
For some reason my form won't open when the workbook is opened. I get an error message "run time error '424' object required" (which happens when I have Form1.show in the BOTH workbook_open event and the userform_initialize event (oops)). When I removed form1.show from the userform_initialize I don't get an error but I also get no form. I recall having this issue before but I can't recall how to fix it.
Can I call the userform_initialize event from the workbook open event to get around this successfully and properly?
View 9 Replies
View Related
Dec 4, 2009
I keep getting a Run Time Error 1004 (Application Defined or Object Defined Error) when my sub reaches this line:
ActiveCell.Formula = "=SUM(D222,D224,D226,D227,D229,...)"
In the actual line of code the "..." above is another 20-30 or so cells in column "D". Probably no more than 150-170 characters in the line.
If I remove half of the cell range names it works, but I need all of the cell ranges for the equation.
View 9 Replies
View Related
Jul 24, 2007
I am trying to copy the info from one workbook to another workbook.
I keep getting the above referenced error...
Private Sub CommandButton1_Click()
Dim filepath As String
filepath = Range("A100")
MsgBox ("File Appended")
Workbooks.Open (filepath)
Windows("CorrespondenceMaster.xls").Activate
Sheets("Sheet2").Select
Range("DesNo", "LocationPath").Select
Selection.Copy
Windows(filepath).Activate
Range("A2").Select
ActiveSheet.Paste
End Sub
View 3 Replies
View Related
Jul 28, 2009
I copied a routine from this forum that would email a single sheet from a 10-sheet workbook to a recipient. This worked great for a long time, then all of a sudden I started getting the "ActiveX control can't create object" error. Here is my
View 14 Replies
View Related
Oct 12, 2008
I'm trying to open a file and perform various tasks. This is the structure:
Dim xlApp As Object
Dim xlWb As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWb = xlApp.Workbooks.Open(BackupFile) ' backupfile evaluates to c: esting est.xls
xlWb.Worksheets(1).Activate
Debug.Print xlWb.Worksheets.Count
Dim ws As Worksheet
For Each ws In xlWb.Worksheets
Debug.Print ws.Name
ws.Activate
Next ws
I think I'm totally missing something. The above works, except for the loop. None of the names show up in my immediate window, and none of the worksheets are activated. xlWB evaluates to nothing, which is where the problem has to be...but why would my first .Activate and Debug.Print lines work? Also, If I declare xlWb as Workbook then absolutely nothing works after the file is opened.
Basically what I want to do is open the file, do a bunch of a stuff with it, then save and close it. I have this all working without creating another object, but the opening of the file is still visible to the user. Seems like turning off ScreenUpdating doesn't truly work.
View 9 Replies
View Related
Feb 7, 2007
I want to create a macro to open a webpage, and with that webpage fill out the fields on the webpage and then hit enter and move to next record. I am having great difficulties with establishing Internet Explorer as my object and maneuvering around inside of it. My data would being in column A so i would expect to use the string below when referencing my data.
Do Until Workbooks(2).Worksheets(1). Range("A" & row) = ""
View 9 Replies
View Related
Jul 24, 2012
Am getting Object variable not set error in the selection.find code. I dont see anything wrong with the code..
VB:
rivate Sub Btn_Edit_Click() ' code for Edit Function
Dim findvalue As String
Dim FileName As String
[Code].....
I can see the value of "findvalue" do exist in the column "A:A".
View 3 Replies
View Related
Jul 20, 2013
I am trying to make this code work, I am getting the subject error:
HTML Code:
Private Sub CommandButton1_Click()Dim cols As VariantDim NextRow As ObjectDim Myrow As Object
Sheets("Sheet1").SelectWith Sheet1
Myrow = Range("A" & Rows.Count).End(xlUp).Row + 1
[Code] .....
View 5 Replies
View Related
Jul 28, 2007
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 7/28/2007 by i8ig
'
If Target.Column = 1 Then
If Target.Value = "Med" Then
Rows(Target.Row).Interior.ColorIndex = 4
Range("H3").Select
ActiveCell.FormulaR1C1 = "=IF(RC[3]="""","""",RC[3]-3)"
Else
If Target.Value = "Tasc" Then
Rows("4:4").Interior.ColorIndex = 44
Range("H4").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]="""","""",RC[1]-2)"
Else
If Target.Range = "NBAR" Then
Range("J5").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]="""","""",RC[1]-5)"
Range("I5").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]="""","""",RC[1]-2)"
Range("H5").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]="""","""",RC[1]-2)"
End If
End If
End If
End If
End Sub
I continue to receive an error '424' object required and I cant find it
View 9 Replies
View Related
Nov 3, 2009
I have two worksheets one called "invoice" and one called "tenants"
"Invoice" has a userform where I want to enter a tenancy number and then lookup the tenants name and address from "tenants"
I have put the following macro in
Sub lookup()
Dim res As Variant
res = Application.VLookup("A1", Tenants.xlsx("Sheet1"), "$A:$H", 2, False)
If IsError(res) Then
MsgBox "not found"
Else
MsgBox "found at pos: " & res
End If
End Sub
but get the following error - "object required"
View 9 Replies
View Related
Sep 4, 2006
I am trying to get the code to search for me specific words in the excel files in my Folder as specified, however when i try to run it, there will be a Error 424 : Object required.
Sub SearchText()
cr = vbCrLf
quot = Chr(34) 'quotes
Dim l As FileSearch
Set l = Application.FileSearch
s = InputBox("Search", " Enter the text you're looking for.")
With l
.NewSearch
.LookIn = "D:FinancialNews"
.SearchSubFolders = True
.FileName = "*.xls"
.MatchTextExactly = True ............................
View 9 Replies
View Related
Jan 20, 2007
Private Sub Worksheet_SelectionChange(ByVal target As Range)
If programmatic Then Exit Sub
selectionChange (target) ' 424 occurs on this line
End Sub
Private Sub selectionChange(target As Range)
' sub implementation here
I can't see anything wrong with my sub call that would cause a 424: Object Required.
View 3 Replies
View Related
Aug 3, 2007
I am trying to name a dynamic range. The below works when I have selected the relevant sheet. However, if the sheet is not selected then I get a Runtime Error 1004 at the Else line. I had planned on naming 3 ranges like this on each sheet. I have 15 sheets, so end result will be 45 ranges.
Sub CIT_SLA()
'Name and size the range CIT_SLA so the Word file (EOM Report) can pick only the relevant cells
If Sheets("CIT Results").Range("A2").Value = "" Then
Sheets("CIT Results").Range("A2:G2").Name = "CIT_SLA"
Else: Sheets("CIT Results").Range("A2", Range("G65536").End(xlUp)).Name = "CIT_SLA"
End If
End Sub
View 6 Replies
View Related
Oct 16, 2008
I'm trying to learn about class modules and how to create object that i can manipulate within a sheet.
i'd like to create a simple cirlce object that i can visibley see on a sheet.
is this possible and if so any idea on how i start?
View 3 Replies
View Related
Apr 10, 2007
Create Range Object & Pass To A Subroutine
Sub Test(ByRef objRange As Range)
objRange.Value = "Hi"
End Sub
Sub TestTheTestMethod()
With ThisWorkbook. Sheets("Sheet1")
Set objRange = .Range(.Cells(1, 1), .Cells(i - 1, 3))
objRange.Value = "Hi" 'This works fine !
Test (objRange) 'But here... Getting ERROR 424 -- Object Required
End With
End Sub
View 2 Replies
View Related
Jan 12, 2010
I haven't figured out who hates who more, me hating VBA or VBA hating me.. we just do not get along very well.
Anyways, I am having difficult understanding why I am getting the following error:
Error 1004: application defined or object-defined error.
I am using code that I just copied over from a worksheet where it was working fine. This is part of it.
View 6 Replies
View Related