以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]VBA代码转为 狐表的 按钮代码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=131737)

--  作者:方丈
--  发布时间:2019/3/5 17:55:00
--  [求助]VBA代码转为 狐表的 按钮代码

请教 有点甜 有点蓝 ,以下的VBA代码怎样转换为狐表中窗口中的按钮代码?谢谢!

狐表中模板是(ProjectPath & "Attachments\\订单模板.xls")。


Sub AutoCopySheets()

Dim i, j As Integer

i = 1

j = 1

For i = 1 To 30   \'循环30次,相当于复制30个工作表

j = j + 1

    Sheets("8.1").Copy After:=Sheets(Sheets.Count)              \'复制工作表《8.1

    Sheets(Sheets.Count).Name = "8" & "." & j                   \'重命名工作表

    Sheets(Sheets.Count).Range("G4") = "20178" & j & ""   \'单元格G4自动填写相应的日期

   

If j Mod 7 = 5 Or j Mod 7 = 6 Then    \'判断表格的日期是否是星期六或星期天,如果是,则改变工作表标签颜色

    With ActiveWorkbook.Sheets(Sheets.Count).Tab

      .Color = 255                                 \'工作表标签改成红色

      .TintAndShade = 0

    End With   

End If

Next  

End Sub

[此贴子已经被作者于2019/3/5 17:57:39编辑过]

--  作者:有点甜
--  发布时间:2019/3/5 18:03:00
--  

参考

 

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\\Report.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("同期对比") \'指定要复制的工作表
With Wb.WorkSheets
    Ws.Copy(After:=.Item(.Count))\'复制到最后面
    Ws.Copy(Before:=.Item(1))\'复制到最前面
    Ws.Copy  \'复制到一个新工作簿
End With
Wb.Save
App.Quit

 

http://www.foxtable.com/webhelp/scr/2121.htm