Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting unformated text into clipboard

Status
Not open for further replies.

Cresby

Programmer
Aug 15, 2002
287
GB
Word seems to refuse and I can only make it copy by using F5
Sub Macro1()
Selection.WholeStory
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.PasteSpecial Link:=False, DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False
Selection.WholeStory
Selection.Range.Case = wdUpperCase
Selection.Copy
End Sub


Excel fails on the magic instructions put in clipboard

Sub CommandButton7_Click()
Set fred = New DataObject
Sheets("Sheet2").Select
' Sheets("Sheet2").Range("A1").Paste
ActiveSheet.Paste
Sheets("Sheet2").Range("A1").Value = UCase(Sheets("Sheet2").Range("A1").Value)
Application.CutCopyMode = False
Sheets("donelist").Select
fred = Sheets("SHEET2").Range("A1").Value

fred.PutInClipboard SetText
End Sub
 
I forgot to say this is to paste into AutoCad which does things differently most of the time but accepts RTF from clipboard. I need plain text to preserve the AutoCad consistency (and their non-standard Fonts).
 
Don't know if this helps. But in my excel app I use the following syntax when pasting data to clipboard:-

fred.settext ...
fred.putinclipboard ...

and not combining into one statement as you seem to be.

Cheers.
 
I will try that

I cut and paste from Excel Help so I just did what I was told. Having said that there was a typo where there was a missing underscore continuation, so I was expecting trouble.
 
Yea - for the record this is what I did

fred.SetText (Sheets("SHEET2").Range("A1").Value) '...
fred.PutInClipboard '...

(I don't have VBA help at work!!!!) I had to guess when it reported errors with - "Argument not optional"


Thanks for the starter clues..............
 
Can you use API's in VBA?
(Sorry I am a vb guy not a vba guy)

if you can use the clipboard api, you can specify the format of the clipboard data (ie plaintext)

- J
 
You absolutely can use APIs in VBA!

Declare the API function, just like in VB.

Then use the function, just like VB.

Gerry
 
Yea - API's - I have a wonderful helpmate called (at work so guessing) X-tech - lists API's and what the arguments mean and worked examples BUT the data are limted and whole subject is a language in itself. Not for the faint hearted - I did it to improve my employability and only scratched the surface.

Try the VBA Module called Worksheet. It only offers Declarations. That is where you declare API's and Data types and constants and ..... (am I loosing you?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top