以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 求导出文件重命名代码 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=104671) |
-- 作者:tingke -- 发布时间:2017/8/2 20:46:00 -- 求导出文件重命名代码 比如我有一个客户,名叫G3K,希望导出名是客户名+日期,比如今天那就是G3K8-2这种 |
-- 作者:有点甜 -- 发布时间:2017/8/2 20:51:00 -- 参考
dim str as string = user.name |
-- 作者:tingke -- 发布时间:2017/8/2 22:37:00 -- 回复:(有点甜)参考 dim str as string = ... Dim Book As New XLS.Book("E:\\onedrive\\Doosung\\G3K\\G3K模板.xlsx") Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "Excel文件|*.xlsx" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then Book.Save(dlg.FileName) Dim Proc As New Process Proc.File = dlg.FileName Proc.Start() End If 怎么把刚才您发的那段代码加进去?加在哪里?
|
-- 作者:有点甜 -- 发布时间:2017/8/2 22:49:00 -- Dim Book As New XLS.Book("E:\\onedrive\\Doosung\\G3K\\G3K模板.xlsx") Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "Excel文件|*.xlsx" \'设置筛选器 dlg.FileName = user.name & format(Date.today, "M-d") & ".xlsx" If dlg.ShowDialog = DialogResult.Ok Then Book.Save(dlg.FileName) Dim Proc As New Process Proc.File = dlg.FileName Proc.Start() End If |
-- 作者:tingke -- 发布时间:2017/8/3 1:41:00 -- 回复:(有点甜)Dim Book As New XLS.Book("E:\onedr... 非常感谢 |
-- 作者:tingke -- 发布时间:2017/8/3 2:01:00 -- 回复:(有点甜)Dim Book As New XLS.Book("E:\onedr... Dim Book As New XLS.Book("E:\\onedrive\\Doosung\\G3K\\G3K模板.xlsx") Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog dlg.Filter= "Excel文件|*.xlsx" \'设置筛选器 dlg.FileName = G3K & format(Date.today, "M-d") & ".xlsx" If dlg.ShowDialog = DialogResult.Ok Then Book.Save(dlg.FileName) Dim Proc As New Process Proc.File = dlg.FileName Proc.Start() End If 我想直接命名成“G3K8-3”这种,可是出来名称是“管理员8-3”,修改代码后,提示G3K未定义。
|
-- 作者:有点甜 -- 发布时间:2017/8/3 9:10:00 -- 改成
dlg.FileName = "G3K" & format(Date.today, "M-d") & ".xlsx" |
-- 作者:tingke -- 发布时间:2017/8/3 19:23:00 -- 回复:(有点甜)改成 dlg.FileName = "G3K"... 跪拜大神,谢谢 |