Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Пользователь


Сообщения: 143
Благодарности: 24

Профиль | Отправить PM | Цитировать


Pozia,
Код: Выделить весь код
#include <Excel.au3>

	$sheet = "Лист1" ; Название листа на котором находятся данные
	$num_row_start 	= 6 ; начальная строка
	$num_col_start 	= 2 ; начальный столбец
	$num_row_end	= $num_row_start+8 ; конечная строка

$sFile = @ScriptDir & '\file.ext'
$sFilePath1 = @ScriptDir & "\book.xls" 
$oExcel = _ExcelBookOpen($sFilePath1,0)

If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Shame on you!")
    Exit
EndIf

_ExcelSheetActivate($oExcel, $sheet)

If @error = 1 Then
    MsgBox(0, "Error!", "Specified object does not exist")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "Specified sheet number does not exist")
    Exit
ElseIf @error = 3 Then
    MsgBox(0, "Error!", "Specified sheet name does not exist")
    Exit
EndIf
$hWrite = FileOpen($sFile, 2)
	
	For $i = 0 to ($num_row_end - $num_row_start)
	
		$sCellValue_t = _ExcelReadCell($oExcel, $num_row_start + $i, $num_col_start) ; название ячейки
		$sCellValue_d = _ExcelReadCell($oExcel, $num_row_start + $i, $num_col_start+1);значение ячейки	
	
		FileWriteLine($hWrite, $sCellValue_t & $sCellValue_d)

	Next

FileClose($hWrite)
_ExcelBookClose($oExcel, 0, 0)
MsgBox(0,"", "Файл записан",3)

Последний раз редактировалось HORRIBLE, 22-12-2009 в 23:05.

Это сообщение посчитали полезным следующие участники:

Отправлено: 22:10, 22-12-2009 | #21