etech0
asked on
dataobject in excel 2010 vba
Hi! With some help from the experts I compiled the following macro.
Sub getfname()
Dim cltxt As dataobject
Set cltxt = New dataobject
Dim txt As String
txt = Right(ActiveDocument.Path, Len(ActiveDocument.Path) - InStrRev(ActiveDocument.Pa th, "\")) & " - " & Left(ActiveDocument.name, Len(ActiveDocument.name) - InStrRev(ActiveDocument.na me, "."))
cltxt.SetText (txt)
cltxt.PutInClipboard
End Sub
It works fine in Excel 2007, but in 2010 I get the error User-type defined not defined
Can anyone help?
Sub getfname()
Dim cltxt As dataobject
Set cltxt = New dataobject
Dim txt As String
txt = Right(ActiveDocument.Path,
cltxt.SetText (txt)
cltxt.PutInClipboard
End Sub
It works fine in Excel 2007, but in 2010 I get the error User-type defined not defined
Can anyone help?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Slow fingers :)
ASKER
Do you know which reference it is?
Alternatively, maybe you know how to pass a variable to the clipboard in vba...
Alternatively, maybe you know how to pass a variable to the clipboard in vba...
Nice to be (slightly) ahead of you, for once!
tools, references, Microsoft forms 2.0 Object Library - at least on my machine
ASKER
Thanks to both of you.
However, I don't have "Microsoft Forms 2.0 Object Library" in the list of references!
help!!!
However, I don't have "Microsoft Forms 2.0 Object Library" in the list of references!
help!!!
etech0,
(1) Please see attached...
(2) "pass a variable to the clipboard in vba" - do you mean more than replacing 3.1415926 by a variable name?
Thanks,
Brian.
(1) Please see attached...
(2) "pass a variable to the clipboard in vba" - do you mean more than replacing 3.1415926 by a variable name?
Thanks,
Brian.
ASKER
@redmondb: Huh?
as you may have noticed in my code, I have a variable called txt which stores the file name and location in the format I require.
I would like to "copy" the data in this variable to the clipboard, so that I can paste it in the location of my choice.
as you may have noticed in my code, I have a variable called txt which stores the file name and location in the format I require.
I would like to "copy" the data in this variable to the clipboard, so that I can paste it in the location of my choice.
ASKER
I see, but I don't have that item in my list!
etech0,
Apologies, there's another DataObjects question open at the moment and I cross-posted.
The Forms reference is in the list, but the sequence in that dialogue can be peculiar.
Regards,
Brian.
Apologies, there's another DataObjects question open at the moment and I cross-posted.
The Forms reference is in the list, but the sequence in that dialogue can be peculiar.
Regards,
Brian.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks all for your help!
"try clicking browse, navigate to c:\windows\system32 - you are looking for FM20.dll" did the trick!
"try clicking browse, navigate to c:\windows\system32 - you are looking for FM20.dll" did the trick!
Thanks, etech0. Good thinking regmigrant.