|
楼主 |
发表于 2006-1-4 11:40
|
显示全部楼层
根据守柔的代码,将程序修改如下:
Private Sub Document_Open()
Dim myName As String, tName As String, atable As Table, ashape As Shape
Application.ScreenUpdating = False
With ActiveDocument
myName = Mid(.Name, 1, 4)
Select Case myName
Case "银河财经"
myName = "cjnc"
tName = "银河财经内参"
Case "银河资本"
myName = "zbnc"
tName = "银河资本市场内参"
Case "银河高端"
myName = "gdnc"
tName = "银河高端内参"
Case "公司研究"
myName = "gsyjsl20"
tName = "公司研究速览"
Case Else
Exit Sub
End Select
.Content.Cut
.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _
1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With .Tables(1)
If Not .Style = "网格型" Then .Style = "网格型"
.Cell(1, 1).Range.Paste
End With
For Each atable In .Tables
atable.Rows.Alignment = wdAlignRowCenter
Next
'删除图形对象
For Each aShape In .Shapes
aShape.Delete
Next
.Tables(1).Columns(1).SetWidth ColumnWidth:=547.55, RulerStyle:=wdAdjustNone
.BuiltInDocumentProperties(wdPropertyTitle) = tName 'WEB标题
.SaveAs FileName:="C:\Documents and Settings\whcj\桌面\当日工作\" & myName & Format(VBA.Date, "yymmdd") & ".htm", FileFormat:=wdFormatHTML
End With
Application.ScreenUpdating = True
End Sub
这样修改以后,删除图形与命名Title都可以一起完成了。
由于不太清楚嵌入式图形是做什么用的,所以这一句没有加入。
'删除嵌入式图形对象(视情况是否需要)
For Each aLineshape In .InlineShapes
aLineshape.Delete
Next
同时也想问一下守柔老师在WORD文档中,嵌入式图形是做什么用的,图形与嵌入式图形有什么区别? |
|