Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Paste Clipboard (Table) into NOTEPAD

Does anybody know how to paste a table which is in the ClipBoard into a NOTEPAD file using vbscript. The code i'm trying to get is something like this

SUB Email349Archivo ()

'We Set the File Path

Set oShell = CreateObject("WScript.Shell")

Set fso = CreateObject("Scripting.FileSystemObject")

strFilePath = oShell.CurrentDirectory & "\349.TXT"

'We copy the Table

Set obj = ActiveDocument.GetSheetObject("CH166")

obj.CopytableToClipboard  TRUE

Dim Value

Set myFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = myFSO.CreateTextFile(strFilePath, True)

What must I do here?

objTextFile.Close

SET objTextFile = NOTHING

SET myFSO = NOTHING

SET obj = NOTHING

END SUB

2 Replies
Not applicable
Author

Hello Pedro.

Can you solve the problem??

Thanks.

vlad_komarov
Partner - Specialist III
Partner - Specialist III

Pedro, Daniel,

Just FYI:

I was looking for similar problem's solution and have found a post: Exporting a text object to HTML file using macro

The following code works fine in my case:

' Txt object 01

set cs = ActiveDocument.GetSheetObject("TX01")

'msgbox cs.GetText()

Set objFSO=CreateObject("Scripting.FileSystemObject")

' How to write file

outFile="\\....\data_ex\Document1.txt"

Set objFile = objFSO.CreateTextFile(outFile,True)

objFile.Write cs.GetText() & vbCrLf

objFile.Close

REgards,

Vladimir