Question for Tom O

  • Thread starter Thread starter Mitch
  • Start date Start date
M

Mitch

Tom....I tried the code below to clear the Office
clipboard:

CommandBars("clipboard").Controls("ClearClipboard").Execute

When it tries to execute this line of code, I get the
following run time error:

Run Time Error '5' - Invalid procedure call or arguement

Am I doing something wrong? Did I miss a step?

Thanks a bunch for all of your help.....Mitch
 
Mitch,

Nobody would ever mistake me for Tom, but it looks like you need a space
between Clear and Clipboard:

CommandBars("clipboard").Controls("Clear Clipboard").Execute

hth,

Doug
 
What I posted:

CommandBars("clipboard").Controls("Clear Clipboard").Execute
What you posted
CommandBars("clipboard").Controls("ClearClipboard").Execute

See the difference. I have a space between clear and clipboard.

You will get an error if the office clipboard is already empty.

Once you are sure it works, you can do this

On error resume next
CommandBars("clipboard").Controls("Clear Clipboard").Execute
On Error goto 0
 
Tom....Thanks for the help.....Bad eyes and fat fingers
got me again. Thanks again for the help....Mitch
 
Hi
I try to execute the foollowing recorded macro
And i get the same error
Run Time Error '5' - Invalid procedure call or arguement
Did I missed something..? :( I'm using Office 2003.

Sub Macro1()

CommandBars("clipboard").Controls("Clear Clipboard").Execute

End Su
 
Does the office clipboard actually have something stored in it? I believe
you will get this error if it doesn't (doesn't need to be cleared).

On Error Resume next
CommandBars("clipboard").Controls("Clear Clipboard").Execute
On Error goto 0
 
Thank You
No clipboard is not empty. At least Excel clipboard. Also Can I get Al
Clipboard data using a macro (not form)
 
These macros may demonstrate why clipboard doesn't work for my excel
Because there is no clipboard control...???
I Also submit the resulting excel file


Sub Macro1()

'CommandBars("clipboard").Controls("Clear Clipboard").Execute

Dim i
i = 1
'This writes the names of controls
For Each Item In CommandBars
Range("A1").Cells.Item(i).Select
ActiveCell.Value = CommandBars.Item(i).Name
i = i + 1
Next

'Total number of Controls
Range("B1").Select
ActiveCell.Value = CommandBars.Count

'Here we see that clipboard is n'th(See Cell B2)
'If you go to 'An' Cell you see the clipboard
Range("B2").Select
ActiveCell.Value = CommandBars("clipboard").Index

'here count gives zero. Basicly there is no control of clipboard
'There should be at least 1 control bu there is not
'Which version dou you use. Can an office xp resolves this
'Briefly there exist no 'Clear Clipboard' control on clipboard
'or it is unreachable or there should be another way
Range("B3").Select
ActiveCell.Value = CommandBars("clipboard").Controls.Count

End Sub


Sub Macro2()
'
' Macro2 Macro
' Macro recorded 3/11/2004 by ibrahim onaran
'

Dim i, j, k, n
i = 1
j = 1
k = 1
n = 1
'This writes the names of controls
'For Each Item In CommandBars
For m = 1 To CommandBars.Count
If j = 120 Then
j = j
End If
Range("C1").Cells.Item(i).Select
ActiveCell.Value = CommandBars.Item(j).Name
i = i + 1
If CommandBars.Item(j).Controls.Count > 0 Then
For k = 1 To CommandBars.Item(j).Controls.Count
Range("D1").Cells.Item(i).Select
'ActiveCell.Value = "B" & k
ActiveCell.Value
CommandBars.Item(j).Controls.Item(k).Caption
i = i + 1
Next
Else
Range("D1").Cells.Item(i - 1).Select
ActiveCell.Value = "*******"
End If
j = j + 1
Next
m = 1
Range("E1").Cells.Item(m).Select
m = m + 1
ActiveCell.Value
CommandBars.Item(121).Controls.Item(1).DescriptionText
Range("E1").Cells.Item(m).Select
m = m + 1
ActiveCell.Value = CommandBars.Item(121).Controls.Item(1).ID
Range("E1").Cells.Item(m).Select
m = m + 1
ActiveCell.Value = CommandBars.Item(121).Controls.Item(1).Parameter
Range("E1").Cells.Item(m).Select
m = m + 1
ActiveCell.Value = CommandBars.Item(121).Controls.Item(1).TooltipText
Range("E1").Cells.Item(m).Select
m = m + 1
ActiveCell.Value = CommandBars.Item(121).Controls.Item(1).OLEUsage

Range("E1").Cells.Item(m).Select
m = m + 1
ActiveCell.Value = CommandBars.Item(121).Controls.Item(1).Type
'
End Su

Attachment filename: macrdene.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=47133
 
Dear Mr. Tom
Can you prepare a working excel file that works with clipbpard.. I'
very new in this programming, I'm not sure, but I may mistakes whil
witing code or using it ..
Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top