看论坛例子抄的最终版 还是不明白为什么这样能换行#include <Excel.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <string.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("标准答案", 191, 241, 820, 716)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 195, 190, $ES_WANTRETURN)
GUICtrlSetFont(-1, 16, 400, 0, "微软雅黑")
$Button1 = GUICtrlCreateButton("标准答案", 0, 192, 192, 48)
GUICtrlSetFont(-1, 16, 400, 0, "微软雅黑")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$a = GUICtrlRead($Edit1)
$b = StringLen($a)
;For $i = 1 To Round($b / 30)
;If $i = 1 Then
; $a = _StringInsert($a, @CRLF, $i * 30)
; Else
;$a = _StringInsert($a, @CRLF, $i * 30 + ($i - 1))
;EndIf
; Next
Local $oExcel = _Excel_Open()
Local $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\1.xls")
Local $sSource = $a
Local $sSRERe = StringRegExpReplace($sSource, '(?<=\w)', @CRLF)
ClipPut ( $sSRERe )
ClipGet ( )
$oExcel.ActiveSheet.Range("F3").PasteSpecial
MsgBox(0, "", "标准答案已复制",1)
$oWorkbook1.Save()
$oExcel.Quit
EndSwitch
WEnd
|