User Defined Type Not Defined

Aug 28, 2008

This code works fine when I use it, but not when a co-worker uses it on his PC. The code and VBA references are the same. He gets the "User-Defined Type not defined" error. I'm wondering if there is an Outlook setting that may blow this up.

the code was working on his PC and then it stopped though no changes were made to the code. That's why I think it may be blocked by an Outlook setting.

Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
MailOutLook.Subject = "E-mail"

View 9 Replies


ADVERTISEMENT

Excel 2003 :: Stuck On User-defined Type Not Defined Error?

Oct 9, 2012

Trying to convert an Excel 2003 macro to work in Excel 2007.

The problem line is

Dim MyDataObject As DataObject

I suspect the problem is a Missing Reference, but I cannot figure out which one. I have the same ones (in 2007) as 2003 except for one which is not showing

Microsoft Forms 2.0 Object Library

Is this the one it needs? It is called something else in 2007?

The ones I do have ticked are

Visual Basic For Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.8 Library
Microsoft Scripting Runtime
Microsoft XML v2.6

View 8 Replies View Related

Excel 2010 :: User-Defined Type Not Defined Compile Error When Creating PowerPoint Using VBA

Jul 29, 2014

I am using Microsoft Excel 2010 and Microsoft VBA 7.0 on my system. I would like to eventually create a PowerPoint and insert charts generated in the Excel workbook. In the meantime, I cannot get the basic PowerPoint created.

The line in red is highlighted blue when the compile error "User-defined type not defined" message box appears.

Public Sub TryAgain() Dim myPowerPoint As PowerPoint.Application
'
' do nothing for now
'End Sub

I have set the references such that Microsoft Project 14.0 Object Library is indeed checked. The Excel file only contains this code in a module. All sheets are blank. Nothing else is written yet.

View 1 Replies View Related

File System Object: User-Defined Type Not Defined

Nov 28, 2006

I had a working subroutine which I moved to another workbook (rather than linking to it and having both workbooks open at the same time).

Now I get "user-defined type not defined" when it runs. Here is the beginning of the
Global oApp As Object

Sub UpdateForecasts()
Call Update1
Call Update2
End Sub

Sub Update1()
Dim dPath As String
Dim dDest As String
Dim dCondition As String
Dim dName As String
Dim FSO As New FileSystemObject

View 9 Replies View Related

Excel 2010 :: Win 8 User Defined Type Not Defined?

May 5, 2013

Base 64 Encoding.

Dim objXML As MSXML2.DOMDocument
Dim objNode As MSXML2.IXMLDOMElement

Are causing the User Defined error, but the same workbook is OK in XP and Win 7.

VB6: Free, Easy and Quick Base64 Encoding and Decoding in Visual Basic [a NonHostile article]

Says you need a reference to Microsoft XML, v2.6 (or later) and the Win8/2010 workbook does have one for Microsoft XML, v6.0

View 1 Replies View Related

User-defined Type Not Defined - Command Bar Control

Mar 4, 2010

I am trying to capture with Worksheet Change a command bar action like paste but I am getting an error :

“User-Defined type not defined”

Do I need a library of sort in References ??


Public Sub Right_Click()

Dim oControl As CommandBarControl

For Each oControl In CommandBars("Cell").Controls
Debug.Print oControl.Caption
If oControl.Caption = "&Paste" Then
oControl.OnAction = "MyPaste"
End If
Next oControl

End Sub

View 9 Replies View Related

User-defined Type Not Defined Error

Jun 27, 2008

When I try to complile my VBA project, I get the following error "User-defined type not defined" but the compiler doesn't point to any line.

I remember what I did last was to rename a form and a Module, but I replaced their old names in all my code with the new ones ... Does this have anything to do with the error I am getting ?

View 9 Replies View Related

User Defined Type Not Defined

Dec 11, 2012

Which I am trying to modify to fit my needs:

Code:

Sub Test()
Const cURL = "Website Here" 'Enter the web address here
Const cUsername = "XXXXXX" 'Enter your user name here
Const cPassword = "XXXXXX" 'Enter your Password here

Dim IE As InternetExplorer
Dim doc As HTMLDocument
Dim LoginForm As HTMLFormElement

[Code] .......

I get the error User Defined type not defined on line:

Code:
Dim IE As InternetExplorer

Do I need to use references? Is there a quick fix for this?

I have code that works for a particular website but I am having trouble making it work for others. This code seems more flexible than the other code:

Code:
Option Explicit

Public Sub Press_Button()

'make sure you add references to Microsoft Internet Controls (shdocvw.dll) and
'Microsoft HTML object Library.
'Code will NOT run otherwise.

[Code] ........

My end goal is to log on to several websites and pull data out of tables on the websites back into excel so that I can have a one stop shop instead of logging into many websites manually.

View 5 Replies View Related

Clearing A Variable Of User Defined Type

Nov 3, 2004

I am currently working in an application in which I use the following user defined types:

Public Type correlationstruct
corr As Variant
corrstd As Variant
lower As Variant
upper As Variant
support As Variant
End Type

I have a public variable called myctafund, of type ctafund:

Public myctafund As ctafund

My problem is the following: When I need to update myctafund, I first want to clean it entirely before putting new values, so as to be sure older values do not stick around (I do not necessarily overwrite all the values of the mycta type).I can't figure out a way of clearing the entire myctafund variable in one shot. I tried:

myctafund=empty

but I am granted by a nasty excel error. I'd like to avoid writing 200 lines of code just to clean the entire variable.

View 9 Replies View Related

New Collection Of User Defined Data Type

Jun 23, 2006

I can create my own new collection which is handy as it accepts uniques only and i can access using its "key"

But can i have a collection of "user defined data types"

View 5 Replies View Related

Pass Element Of User-Defined Data Type

Oct 17, 2007

I have an array with structure, i.e. User Defined Type. Assume the user defined type has two elements: Element1 and Element2 and array name is Array.

So the definition is:

Dim Array(1 To 10) As UserType

and access to elements is

Array(5).Element1

The problem is that I need to pass the whole set of Element1 or Element2 to a function. Should it have been two separate arrays, it would not be a problem. But because of the user defined structure I have no idea how to pass a single element.

I hope there is another solution rather than to use loops. I have many arrays like this with complex structures. I simply can not replicate all of them.

View 9 Replies View Related

Create A User Defined Enumerated Type Typically Used In Other Languages

Apr 18, 2007

I am trying to figure out how to create a "User-Defined" enumerated type typically used in other languages (other than VBA).

for example in Java a typical enum type is declared like this:

enum Season { WINTER, SPRING, SUMMER, FALL }
This gives the benefit of writing "readable" code.

(back to vb)

If Season SUMMER then
call wear_a_sweater
end if

View 9 Replies View Related

"application-defined Or User-defined Error" When Applying Validation In Vba

Sep 16, 2006

I've made a macro that inserts an entire new row above a specified cell, then updates each column of that row using offset.value and various constants and inputbox variables. Works great so far, unless I try to apply a validation rule to one of the cells.

The code I'm using to add the validation works okay when referring to a specific cell by reference e.g:

With Range("A1").Validation

etc...

However, when I change it thusly:

With Sheet2.Range("LastRow").Offset(-1, 5).Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Departments"
.IgnoreBlank = True
.InCellDropdown = True
End With

It doesn't like that one bit.

This is part of a private Sub attached to a button in the same sheet. I've had a scan through the archives looking for validation threads, but couldn't find anything that refers to problems with offsets (if indeed that is the problem here).

View 9 Replies View Related

Application Defined Or Object Defined Error When Creating A Pivot Table

Oct 1, 2009

I keep running into this error when I try to create a pivot table.

The debugger highlights the following line:

View 4 Replies View Related

Set Bold To Font On Another Worksheet: Application Defined Or Object Defined Error

Aug 25, 2006

'Code1
Call movedata(1, rrow, ecol, erow)
'Contact Person
Call movedata(26, rrow, ecol, erow)
Worksheets("new").Activate
Worksheets("new"). Range(Cells(erow, ecol), Cells(erow, (ecol - 2))).Font.Bold = True
'Name
Call movedata(2, rrow, ecol, erow)
'Street Address
Call movedata(3, rrow, ecol, erow)
'city
Call movedata(4, rrow, ecol, erow)
' zip
Call movedata(5, rrow, ecol, erow)
Worksheets("new").Range(Cells(erow, ecol)).Font.Bold = True
' speed dial
Call movedata(6, rrow, ecol, erow)

the first time font.bold is set to true, it completes w/o error. The bolded line returns 'application defined or object defined error 1004'. Ive tried activating the new sheet immediately before setting bold (like the first time it gets set) but it still errors.

View 5 Replies View Related

Application-defined Or Object-defined Error :: Add Named Range At Run-time

Oct 4, 2006

Trying to add a named range at run-time

Here's what I have so far ...

View 9 Replies View Related

Application-Defined Or Object-Defined Error Setting Validation Message

Nov 10, 2006

I have problems with setting Validation input title and message. When in column "C" I type product code, data validation of corresponding cell in column "D" changes to list of diameters allowed for that product. That works fine. But i also want to set validation message to show allowed diameters.I set it in VBA using named ranges.
But for every second line (13, 15, etc on attached file) I get an application-defined or object-defined error. The rest (14, 16 etc) works ok.

View 4 Replies View Related

Application-defined Or Object-defined Error On An Active Cell

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

Application-defined Or Object-defined Error :: On Open Everytime

Jan 13, 2009

I had to change sheet one but everytime I open this workbook, it keep saying "Application-defined or object-defined error"

but I cannot find what is causing the bug. I have checked the name of sheet and it seem correct for me in the codes.

View 7 Replies View Related

Range Selection Error (application-defined Or Object-defined)

Jun 9, 2009

I am having some trouble with a variable range selection within a regression. I keep getting an "application-defined or object-defined error." I've isolated each statement to find that the code that is causing the regression not to work is below (the error for that line of code states that the Select method of Range class failed):

View 6 Replies View Related

Application-defined Or Object-defined Error On Formula Entry

Aug 12, 2009

I'm trying to enter a series of formulas into a worksheet using vba. However, this code is giving me Run time error '1004', along with the description in the title. This is the first formula (they're all relatively similar).

View 2 Replies View Related

Application-Defined Or Object-Defined Error :: Subtracting Hours

May 23, 2007

I have a sub that takes the value of a cell and get the hour by using

mhours = Hour(KRT)

then using DateAdd I need to subtract the mhours from etd

and Im getting this error

Application-Defined or Object-Defined Error

Worksheets(b).Range("G" & q).value = DateAdd("h", mhours, etd)

Note: KRT and ETD are dim'd as Date
Note2: DateAdd returns the same error wether mhours is postive or negitive

View 9 Replies View Related

Application-defined Or Object-defined Error :: Range & Offset

Feb 26, 2009

this is the line it gives the error on.

Range("A1").End(xlDown).Offset(1,0).Select

View 9 Replies View Related

Sort Macro: Application-defined Or Object-defined Error

Aug 29, 2006

I get a run time error 1004 when I run this sort.

ActiveSheet. Range("A1:AC277").Sort Key1:=ActiveSheet.Range("G2"), Order1:=xlAscending, Key2:= _
ActiveSheet.Range("E2"), Order2:=xlAscending, header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal

View 9 Replies View Related

AdvancedFilter: Application-defined Or Object-defined Error 1004

Nov 14, 2006

Im trying to copy all the unique values from one column to another and the easiest way seems to be:

Set SourceRange = Worksheets(page2). Range("C1:C17365")
SourceRange. AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Worksheets(sida3).Range("B"), Unique:=True

However, I get the error- message: Run-time error '1004': Application-defined or object-defined error

View 2 Replies View Related

Application Defined Or Object Defined Error 1004

Jun 1, 2009

I get runtime error 1004 "Application Defined or Object Defined Error" when I try to do the following:

View 4 Replies View Related

Application-defined Or Object-defined Error Using Range

Jun 5, 2009

So I'm correcting macro at work and keep running into this error:
"Application-defined or object-defined error"

View 5 Replies View Related

Application-defined Or Object-defined Error On One Machine But Not The Other

Jul 31, 2009

I'm trying to figure out why I can run a bit of code on my machine but on another machine I get an: Application-defined or object-defined error. The code is in an excel file on a network drive and it pulls up a form, once the form is submitted it runs some code that looks like so

View 2 Replies View Related

1004 Application-defined Or Object-defined Error

Jul 1, 2008

When opening a blank excel workbook I receive the error "1004 Application-defined or object-defined error". I press OK. And the message appears 2 more times before I am able to work in Excel. Doesn't matter what excel file I am opening, does the same thing. I do not know how to lookup programming code for any macros I am running. I would like to get rid of this error! It is a nusance.

View 9 Replies View Related

Application Defined Or Object Defined Error In Code

Apr 26, 2006

I am getting an 'application defined or object defined' error at the code coloured red. I'm trying to sort a list of names starting at c5


'Update Names on Sheets
If Sheets("Daily Visits May").Range("e1") = "y" Then Goto 10
If Sheets("Daily Visits May").Range("d1") > 38837 Then Else Goto 10
Sheets("Daily Visits Apr").Select
Range("b5:c660").Select
Selection.Copy
Sheets("Daily Visits May").Select
Range("b5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("C5"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved