ให้กดเมาวส์ขวา และ เลือก Export to CVS
ตัวอย่าง code โดย VB เป็น Com Register
Private Sub CommandButton1_Click()
Dim RobApp As RobotApplication
Set RobApp = New RobotApplication
Dim t As RobotTable
Dim tf As RobotTableFrame
Dim path As String
Dim Fullpath As String
Dim FName As String
path = Environ$("temp")
Dim nTables As Long
nTables = RobApp.Project.ViewMngr.TableCount
If nTables = 0 Then
MsgBox "No table opened"
Exit Sub
End If
For I = 1 To nTables
Set tf = RobApp.Project.ViewMngr.GetTable(I)
FName = tf.Window.Caption
spacepos = InStr(1, FName, " ")
If spacepos <> 0 Then
FName = Left(FName, spacepos)
End If
ntabs = tf.Count
For j = 1 To ntabs
tf.Get(j).Window.Activate
Set t = tf.Get(j)
tf.Current = j
tabname = tf.GetName(j)
DoEvents
Fullpath = path + "\" + FName + tabname + ".csv"
t.Printable.SaveToFile Fullpath, I_OFF_TEXT
NP = Shell("C:\WINDOWS\notepad.exe " + Fullpath, vbNormalFocus)
AppActivate NP
SendKeys "%ER", 1
'replacing decimal separator
SendKeys ",", 1
SendKeys "{TAB}", 1
SendKeys ".", 1
''''''''''''''''''''''''''''
SendKeys "%A", 1
SendKeys "%{F4}", 1
SendKeys "%ER", 1
'replacing column separator
SendKeys ";", 1
SendKeys "{TAB}", 1
SendKeys ",", 1
'''''''''''''''''''''''''''
SendKeys "%A", 1
SendKeys "%{F4}", 1
SendKeys "%FA", 1
SendKeys Fullpath, 1
SendKeys "%E", 1
SendKeys "{DOWN}", 1
SendKeys "{DOWN}", 1
SendKeys "{UP}", 1
SendKeys "{UP}", 1
SendKeys "{UP}", 1
SendKeys "{ENTER}", 1
SendKeys "%S", 1
SendKeys "%Y", 1
SendKeys "%FX", 1
DoEvents
Workbooks.Open Fullpath
Next j
Next I
MsgBox "Dumping finished"
Set RobApp = Nothing
End Sub
ไม่มีความคิดเห็น:
แสดงความคิดเห็น