Excel VBA Can you set DataObject as text from File? -
is there way contents of text file , add clip board?
i thinking along lines of setting contents of dataobject contents file , adding dataobject clipboard.
is can excel vba?
this code using data txt file in correct format. however, require in clipboard can paste it.
with ws2     open "c:\users\peter.carr\documents\new action plan\copytest.txt" append #1     lastrow = .cells(.rows.count, 1).end(xlup).row     lastcol = .cells(1, .columns.count).end(xltoleft).column     = lastrow 2 step -1         str1 = ""         print #1, ws2.cells(i, 1).value & ") " & ws2.cells(i, 2).value         print #1,             each cell in .range(.cells(i, 6), .cells(i, lastcol))                 g = - 1                 if cell.column <> 4 , cell.column <> 5 , cell.value <> "" , cell.value <> "new action"                     print #1, cell.value                     print #1, "(" & cell.offset(-g, 0).value & ")"                     print #1,                 end if             next cell         next     close #1 end   i know open file , copy it. however, idea part of larger process automate things, hence want able fo without opening file.
sub texttoclipboard()     dim sfile string: sfile = "c:\test.txt"     dim stext string     dim dataobj dataobject     set dataobj = new dataobject         open sfile input #1         stext = input(lof(1), 1)         dataobj.settext stext         dataobj.putinclipboard end sub      
Comments
Post a Comment