Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub ExportTXT()
- '1. Начальная инициализация. Начало таблицы находится в ячейке А6
- 'A6 - caption таблицы
- 'A7+ - строки таблицы
- iFirstLine = 6
- iFirstCol = 1
- iLastLine = iFirstLine
- iLastCol = iFirstCol
- 'HTML классы для таблицы и четного ряда данных
- sTableClass = Cells(2, 2).Text
- sOddRowClass = Cells(3, 2).Text
- 'Поиск ширины и высоты таблицы ведется по первому столбцу и первой строке таблицы после caption
- '2. Поиск высоты таблицы
- j = iFirstLine + 1
- Do While Cells(j, iFirstCol).Text <> ""
- j = j + 1
- Loop
- iLastLine = j - 1
- '3. Поиск Ширины таблиц
- j = iFirstCol
- Do While Cells(iFirstLine + 1, j).Text <> ""
- j = j + 1
- Loop
- iLastCol = j - 1
- '4. Начинаем таблицу
- sOutput = "[table=head]" & vbNewLine
- '5. Обрабатываем Excel таблицу
- For k = iFirstLine + 1 To iLastLine
- sLine = ""
- For j = iFirstCol To iLastCol
- Set oCurrentCell = ActiveSheet.Cells(k, j)
- sLine = sLine & oCurrentCell.Text
- If j <> iLastCol Then
- sLine = sLine & "|"
- End If
- Next j
- sOutput = sOutput & sLine & vbNewLine
- Next k
- sOutput = sOutput & "[/table]"
- '7. Выводим на экран полученный текст
- UserForm1.TextBox1.Text = sOutput
- UserForm1.Show
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement