Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
下载信息 [文件大小: 下载次数: ] | |
![]() |
易表也可做,狐表岂不能乎(只做了单选框)
注:1,为简化代码,Excel报表模板文件名应和单选框名称一致;
2,需于同一目录下另建文件夹『Reports』,打印目录文件放于此(看Excel报表)
Dim Tz(),T,T1,T2 As String
Tz = "顺丰标签,申通标签".Split(",")
For each T in Tz
if e.Form.Controls(T).Checked = True Then
Exit For
End if
Next
T1 = ProjectPath & "Attachments\" & T & ".xls"
T2 = ProjectPath & "Reports\ "& T & ".xls"
Dim Book As New XLS.Book(T1)
Book.Build()
Book.Save(T2)
Dim Proc As New Process
Proc.File = T2
Proc.Verb= "Print"
Proc.Start()
自行去掉"Reports\ "中的空格
测试非常好.但DON老大,我也觉得用组合框选择余地比较大,再给个代码我们测试一下.谢谢!
用ComboBox更简单:
Dim T,T1,T2 As String
T = e.Form.Controls("ComboBox1").value
T1 = ProjectPath & "Attachments\" & T & ".xls"
T2 = ProjectPath & "Reports\ "& T & ".xls"
if T isnot Nothing then
If "顺丰标签,申通标签".Indexof(T) > -1 then
Dim Book As New XLS.Book(T1)
Book.Build()
Book.Save(T2)
Dim Proc As New Process
Proc.File = T2
Proc.Verb= "Print"
Proc.Start()
End if
End if
用ComboBox更简单:
Dim T,T1,T2 As String
T = e.Form.Controls("ComboBox1").value
T1 = ProjectPath & "Attachments\" & T & ".xls"
T2 = ProjectPath & "Reports\ "& T & ".xls"
if T isnot Nothing then
If "顺丰标签,申通标签".Indexof(T) > -1 then
Dim Book As New XLS.Book(T1)
Book.Build()
Book.Save(T2)
Dim Proc As New Process
Proc.File = T2
Proc.Verb= "Print"
Proc.Start()
End if
End if
收藏,谢谢,好好学习,天天向上.
用ComboBox更简单:
Dim T,T1,T2 As String
T = e.Form.Controls("ComboBox1").value
T1 = ProjectPath & "Attachments\" & T & ".xls"
T2 = ProjectPath & "Reports\ "& T & ".xls"
if T isnot Nothing then
If "顺丰标签,申通标签".Indexof(T) > -1 then
Dim Book As New XLS.Book(T1)
Book.Build()
Book.Save(T2)
Dim Proc As New Process
Proc.File = T2
Proc.Verb= "Print"
Proc.Start()
End if
End if
厉害,测试非常爽!