VBA code not working on other PC
The dataobject variable is associated with the Microsoft Forms 2.00 Object
Library
--
Ken
"Using Dbase dialects since 82"
"Started with Visicalc in the same year"
"OssieMac" wrote:
Not sure what the variable is used for however, in your VBA editor, Select
Tools - References and make a list of the references that are checked. Then
have a look at the same on the other computer and make them match. (Note you
must actually check the boxes; not just select the lines.)
--
Regards,
OssieMac
"Simka" wrote:
I am using Excel 2003 and I have been using the VBA code below on my computer
for a long time and find it extremely useful and which has never result in an
error.
A colleague asked if he could also have in on his computer and so I copied
it over. The strange thing is it doesn't seem to work on his computer and I
not sure why. I stops on the line 'Dim Result As New DataObject' that I have
higlighted with the *********. and a dialogue box appears saying: Compile
Error: User defined type not defined.
Does anyone know the answer why it works on my PC and not on his? I think it
might have something to do with declaring the DataObject
Sub AddSelection()
'This routine adds the values of selected cells and
'places the result in the variable 'SumOfRange'
'and also holds the value in the clipboard
Dim SumOfRange As Double
Dim Result As New DataObject '*******
SumOfRange = 0
SumOfRange = Application.WorksheetFunction.Sum(Selection) 'Add the Range
Result.SetText SumOfRange
Result.PutInClipboard
End Sub
|