没有合适的资源?快使用搜索试试~ 我知道了~
创建调用宏的自定义菜单 列中的空白单元格到向下填充值 HTML 文件中创建的目录等
资源推荐
资源详情
资源评论
Range("B4:AC1074").Select
Selection.Copy
Windows("新規 Microsoft Excel 工作表.xlsm").Activate
Range("B3").Select
此代码示例演示如何将从工作表中的数据以及如何在 HTML 文件中创建的目录。工作表应该在第一个,相对应的 A、 B 和 C 列中的数据目录中的目录层次结构的第二和第三个级别。HTML 文件存储在相同的工作文件夹为活动工作簿中。
Sub CreateHTML()
'Define your variables.
Dim iRow As Long
Dim iStage As Integer
Dim iCounter As Integer
Dim iPage As Integer
'Create an .htm file in the same directory as your active workbook.
Dim sFile As String
sFile = ActiveWorkbook.Path & "\test.htm"
Close
'Open up the temp HTML file and format the header.
Open sFile For Output As #1
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<style type=""text/css"">"
Print #1, " body { font-size:12px;font-family:tahoma } "
Print #1, "</style>"
Print #1, "</head>"
Print #1, "<body>"
'Start on the 2nd row to avoid the header.
iRow = 2
Selection.Copy
Windows("新規 Microsoft Excel 工作表.xlsm").Activate
Range("B3").Select
此代码示例演示如何将从工作表中的数据以及如何在 HTML 文件中创建的目录。工作表应该在第一个,相对应的 A、 B 和 C 列中的数据目录中的目录层次结构的第二和第三个级别。HTML 文件存储在相同的工作文件夹为活动工作簿中。
Sub CreateHTML()
'Define your variables.
Dim iRow As Long
Dim iStage As Integer
Dim iCounter As Integer
Dim iPage As Integer
'Create an .htm file in the same directory as your active workbook.
Dim sFile As String
sFile = ActiveWorkbook.Path & "\test.htm"
Close
'Open up the temp HTML file and format the header.
Open sFile For Output As #1
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<style type=""text/css"">"
Print #1, " body { font-size:12px;font-family:tahoma } "
Print #1, "</style>"
Print #1, "</head>"
Print #1, "<body>"
'Start on the 2nd row to avoid the header.
iRow = 2
'Translate the first column of the table into the first level of the hierarchy.
Do While WorksheetFunction.CountA(Rows(iRow)) > 0
If Not IsEmpty(Cells(iRow, 1)) Then
For iCounter = 1 To iStage
Print #1, "</ul>"
iStage = iStage - 1
Next iCounter
Print #1, "<ul>"
Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 1).Value & "</a>"
iPage = iPage + 1
If iStage < 1 Then
iStage = iStage + 1
End If
End If
'Translate the second column of the table into the second level of the hierarchy.
If Not IsEmpty(Cells(iRow, 2)) Then
For iCounter = 2 To iStage
Print #1, "</ul>"
iStage = iStage - 1
Next iCounter
Print #1, "<ul>"
Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 2).Value & "</a>"
iPage = iPage + 1
If iStage < 2 Then
iStage = iStage + 1
End If
End If
'Translate the third column of the table into the third level of the hierarchy.
Do While WorksheetFunction.CountA(Rows(iRow)) > 0
If Not IsEmpty(Cells(iRow, 1)) Then
For iCounter = 1 To iStage
Print #1, "</ul>"
iStage = iStage - 1
Next iCounter
Print #1, "<ul>"
Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 1).Value & "</a>"
iPage = iPage + 1
If iStage < 1 Then
iStage = iStage + 1
End If
End If
'Translate the second column of the table into the second level of the hierarchy.
If Not IsEmpty(Cells(iRow, 2)) Then
For iCounter = 2 To iStage
Print #1, "</ul>"
iStage = iStage - 1
Next iCounter
Print #1, "<ul>"
Print #1, "<li><a href=""" & iPage & ".html"">" & Cells(iRow, 2).Value & "</a>"
iPage = iPage + 1
If iStage < 2 Then
iStage = iStage + 1
End If
End If
'Translate the third column of the table into the third level of the hierarchy.
剩余11页未读,继续阅读
资源评论
Sec_Sunshine
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功