周一至周五 : 08:30 - 17:30 客服专员电话/微信:17301649370 QQ:2902102332
微信咨询

扫码微信咨询

关注公众号

关注微信公众号

电话: 021 5161 9370
返回顶部
资产按明细生成标签
显示全部楼层 正序浏览 发表日期 2018-02-27 08:38:34 12420次阅读 9次回复

1.xls

35 KB, 下载次数: 14

已解决
12420 9
资产按明细生成标签
tony-zyh2018-02-27 08:38:34
本人不会VBA,网上也有贴子关于生成标签的,内容格式类似,请求远程协助,附模板。

1.xls

35 KB, 下载次数: 14

最佳答案

hessen学士 关注Ta

2018-02-27 08:38:35

hessen

2018-3-9 14:16:39

  1. Option Strict Off
  2. Imports SpreadsheetGear
  3. Imports System.Windows.forms
  4. Namespace ExcelViewVBDotnet
  5. Public Class StandardInterface '自定义名称
  6. '预留位置1
  7. '预留位置2
  8. Dim AW As SpreadsheetGear.IWorkbook,Range As SpreadsheetGear.IRange
  9. Dim dr As Integer
  10. Public Sub Workbook_Open(OldRoot As Object,NewRoot As Object,Excel As SpreadsheetGear.Windows.Forms.WorkbookView)
  11. Excel.GetLock()
  12. AW = Excel.ActiveWorkbook
  13. Range = AW.ActiveWorksheet.Range
  14. Excel.ReleaseLock()

  15. End Sub'打开时执行事件

  16. Public Sub RangeSelection(sender As Object,e As SpreadsheetGear.Windows.Forms.RangeSelectionChangedEventArgs)
  17. 'MessageBox.show("测试")

  18. End Sub'单元格选择后执行的事件

  19. Public Sub RangeChanged(sender As Object,e As SpreadsheetGear.Windows.Forms.RangeChangedEventArgs)

  20. End Sub'单元格编辑完成后执行事件

  21. Public Sub ButtunClick(sender As Object,e As SpreadsheetGear.Windows.Forms.ShapeActionEventArgs)
  22. AW.WorkbookSet.GetLock()
  23. If e.Shape.Name = "Button Select" Then
  24. AW.Worksheets("标签打印").Select()
  25. End If

  26. If e.Shape.Name = "Button Copy" Then
  27. AW.Worksheets("标签打印").Range("A7:F" & dr + 18 & "").EntireRow.Delete()
  28. dr = (Int(AW.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
  29. AW.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=AW.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)

  30. Dim x, y, m As Integer
  31. Dim a1, a2 As String
  32. m = 9
  33. For x = 6 To dr - 6 Step 6
  34. For y = 0 To 5 Step 2
  35. a1 = AW.ActiveWorksheet.Cells(x, y).Address
  36. a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
  37. AW.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
  38. AW.Worksheets("标签打印").Cells(x + 1, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 0).Value
  39. AW.Worksheets("标签打印").Cells(x + 2, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 1).Text
  40. AW.Worksheets("标签打印").Cells(x + 3, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 2).Value
  41. AW.Worksheets("标签打印").Cells(x + 4, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 5).Value
  42. AW.Worksheets("标签打印").Cells(x + 5, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 10).Value
  43. m = m + 1
  44. Next y
  45. AW.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
  46. Next x
  47. AW.Worksheets("标签打印").Cells(6, 0).RowHeight = 27
  48. End If
  49. AW.WorkbookSet.ReleaseLock()


  50. End Sub'按钮/标签点击事件

  51. Public Sub FollowHyperlink(sender As Object)

  52. End Sub '暂不支持

  53. End Class
  54. '注:除事件字眼下可以自定义代码外的所有代码不允许改动,否则编译将有可能失败。

  55. End Namespace
复制代码

修复重复生成时提示的问题
电话/微信:18049989370 QQ:857188287
tony-zyh

2018-3-9 09:33:33


谢谢你的热心帮助!
hessen

2018-3-9 08:50:58

  1. AW.WorkbookSet.GetLock()
  2. Dim dr As Integer
  3. If e.Shape.Name = "Button Select" Then
  4. AW.Worksheets("标签打印").Select()
  5. End If
  6. If e.Shape.Name = "Button Copy" Then
  7. dr = (Int(AW.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
  8. AW.Worksheets("标签打印").Range("A7:F" & dr & "").EntireRow.Delete()
  9. AW.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=AW.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)
  10. Dim x, y, m As Integer
  11. Dim a1, a2 As String
  12. m = 9
  13. For x = 6 To dr - 6 Step 6
  14. For y = 0 To 5 Step 2
  15. a1 = AW.ActiveWorksheet.Cells(x, y).Address
  16. a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
  17. AW.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
  18. AW.Worksheets("标签打印").Cells(x + 1, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 0).Value
  19. AW.Worksheets("标签打印").Cells(x + 2, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 1).Text
  20. AW.Worksheets("标签打印").Cells(x + 3, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 2).Value
  21. AW.Worksheets("标签打印").Cells(x + 4, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 5).Value
  22. AW.Worksheets("标签打印").Cells(x + 5, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 10).Value
  23. m = m + 1
  24. Next y
  25. AW.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
  26. Next x
  27. End If
  28. AW.WorkbookSet.ReleaseLock()

复制代码
KB_036e5403-3caf-4ded-95f5-e1667cbfce84_1520556222.rar (3.32 KB, 下载次数: 3)
电话/微信:18049989370 QQ:857188287
tony-zyh

2018-3-9 08:02:13

本帖最后由 tony-zyh 于 2018-3-9 08:06 编辑
hessen 发表于 2018-3-8 17:37
你用VBA代码生成后填入动态库设置即可,若需远程请留下QQ,并增加远程支持币费用

QQ:84783477  生成DLL文件会报错。
hessen

2018-3-8 17:37:29

本帖最后由 hessen 于 2018-3-9 09:26 编辑

你用VBA代码生成后填入动态库设置即可,若需远程请留下QQ
电话/微信:18049989370 QQ:857188287
tony-zyh

2018-3-8 13:59:08


谢谢!,不好意思现在才看到,您看可否远程协助一下,不胜感激!
希望能够远程帮我解决,VBA还不会啊。
本帖最后由 hessen 于 2018-2-27 19:24 编辑

请先参考http://bbs.kuaibiao.cn/forum.php?mod=viewthread&tid=4285
电话/微信:18049989370 QQ:857188287
本帖最后由 hessen 于 2018-3-7 14:05 编辑

biaoqianpiliangdayin.gif

  1. Public Sub ButtunClick(sender As Object, e As SpreadsheetGear.Windows.Co**ols.ShapeActionEventArgs) Implements Interfaces.IExcelWorkBook.ButtunClick
  2. ActiveWorkbook.WorkbookSet.GetLock()
  3. Dim dr As Integer
  4. If e.Shape.Name = "Button Select" Then
  5. ActiveWorkbook.Worksheets("标签打印").Select()
  6. End If
  7. If e.Shape.Name = "Button Copy" Then
  8. dr = (Int(ActiveWorkbook.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
  9. ActiveWorkbook.Worksheets("标签打印").Range("A7:F" & dr & "").EntireRow.Delete()
  10. ActiveWorkbook.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=ActiveWorkbook.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)
  11. Dim x, y, m As Integer
  12. Dim a1, a2 As String
  13. m = 9
  14. For x = 6 To dr - 6 Step 6
  15. For y = 0 To 5 Step 2
  16. a1 = AW.ActiveWorksheet.Cells(x, y).Address
  17. a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
  18. ActiveWorkbook.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
  19. ActiveWorkbook.Worksheets("标签打印").Cells(x + 1, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 0).Value
  20. ActiveWorkbook.Worksheets("标签打印").Cells(x + 2, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 1).Text
  21. ActiveWorkbook.Worksheets("标签打印").Cells(x + 3, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 2).Value
  22. ActiveWorkbook.Worksheets("标签打印").Cells(x + 4, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 5).Value
  23. ActiveWorkbook.Worksheets("标签打印").Cells(x + 5, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 10).Value
  24. 'ActiveWorkbook.Worksheets("标签打印").Cells(x + 6, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Range("F_3970").Cells(0, 0).Text
  25. 'ActiveWorkbook.Worksheets("标签打印").Cells(x + 7, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Range("F_3970").Cells(0, 0).Text
  26. m = m + 1
  27. Next y
  28. ActiveWorkbook.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
  29. Next x
  30. End If
  31. ActiveWorkbook.WorkbookSet.ReleaseLock()
  32. End Sub '按钮/标签点击事件
复制代码

电话/微信:18049989370 QQ:857188287

精彩评论9

hessen

2018-3-9 14:16:39

  1. Option Strict Off
  2. Imports SpreadsheetGear
  3. Imports System.Windows.forms
  4. Namespace ExcelViewVBDotnet
  5. Public Class StandardInterface '自定义名称
  6. '预留位置1
  7. '预留位置2
  8. Dim AW As SpreadsheetGear.IWorkbook,Range As SpreadsheetGear.IRange
  9. Dim dr As Integer
  10. Public Sub Workbook_Open(OldRoot As Object,NewRoot As Object,Excel As SpreadsheetGear.Windows.Forms.WorkbookView)
  11. Excel.GetLock()
  12. AW = Excel.ActiveWorkbook
  13. Range = AW.ActiveWorksheet.Range
  14. Excel.ReleaseLock()

  15. End Sub'打开时执行事件

  16. Public Sub RangeSelection(sender As Object,e As SpreadsheetGear.Windows.Forms.RangeSelectionChangedEventArgs)
  17. 'MessageBox.show("测试")

  18. End Sub'单元格选择后执行的事件

  19. Public Sub RangeChanged(sender As Object,e As SpreadsheetGear.Windows.Forms.RangeChangedEventArgs)

  20. End Sub'单元格编辑完成后执行事件

  21. Public Sub ButtunClick(sender As Object,e As SpreadsheetGear.Windows.Forms.ShapeActionEventArgs)
  22. AW.WorkbookSet.GetLock()
  23. If e.Shape.Name = "Button Select" Then
  24. AW.Worksheets("标签打印").Select()
  25. End If

  26. If e.Shape.Name = "Button Copy" Then
  27. AW.Worksheets("标签打印").Range("A7:F" & dr + 18 & "").EntireRow.Delete()
  28. dr = (Int(AW.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
  29. AW.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=AW.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)

  30. Dim x, y, m As Integer
  31. Dim a1, a2 As String
  32. m = 9
  33. For x = 6 To dr - 6 Step 6
  34. For y = 0 To 5 Step 2
  35. a1 = AW.ActiveWorksheet.Cells(x, y).Address
  36. a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
  37. AW.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
  38. AW.Worksheets("标签打印").Cells(x + 1, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 0).Value
  39. AW.Worksheets("标签打印").Cells(x + 2, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 1).Text
  40. AW.Worksheets("标签打印").Cells(x + 3, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 2).Value
  41. AW.Worksheets("标签打印").Cells(x + 4, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 5).Value
  42. AW.Worksheets("标签打印").Cells(x + 5, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 10).Value
  43. m = m + 1
  44. Next y
  45. AW.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
  46. Next x
  47. AW.Worksheets("标签打印").Cells(6, 0).RowHeight = 27
  48. End If
  49. AW.WorkbookSet.ReleaseLock()


  50. End Sub'按钮/标签点击事件

  51. Public Sub FollowHyperlink(sender As Object)

  52. End Sub '暂不支持

  53. End Class
  54. '注:除事件字眼下可以自定义代码外的所有代码不允许改动,否则编译将有可能失败。

  55. End Namespace
复制代码

修复重复生成时提示的问题
电话/微信:18049989370 QQ:857188287
tony-zyh

2018-3-9 09:33:33


谢谢你的热心帮助!
hessen

2018-3-9 08:50:58

  1. AW.WorkbookSet.GetLock()
  2. Dim dr As Integer
  3. If e.Shape.Name = "Button Select" Then
  4. AW.Worksheets("标签打印").Select()
  5. End If
  6. If e.Shape.Name = "Button Copy" Then
  7. dr = (Int(AW.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
  8. AW.Worksheets("标签打印").Range("A7:F" & dr & "").EntireRow.Delete()
  9. AW.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=AW.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)
  10. Dim x, y, m As Integer
  11. Dim a1, a2 As String
  12. m = 9
  13. For x = 6 To dr - 6 Step 6
  14. For y = 0 To 5 Step 2
  15. a1 = AW.ActiveWorksheet.Cells(x, y).Address
  16. a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
  17. AW.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
  18. AW.Worksheets("标签打印").Cells(x + 1, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 0).Value
  19. AW.Worksheets("标签打印").Cells(x + 2, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 1).Text
  20. AW.Worksheets("标签打印").Cells(x + 3, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 2).Value
  21. AW.Worksheets("标签打印").Cells(x + 4, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 5).Value
  22. AW.Worksheets("标签打印").Cells(x + 5, y + 1).Value = AW.Worksheets("固定资产档案").Cells(m, 10).Value
  23. m = m + 1
  24. Next y
  25. AW.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
  26. Next x
  27. End If
  28. AW.WorkbookSet.ReleaseLock()

复制代码
KB_036e5403-3caf-4ded-95f5-e1667cbfce84_1520556222.rar (3.32 KB, 下载次数: 3)
电话/微信:18049989370 QQ:857188287
tony-zyh

2018-3-9 08:02:13

本帖最后由 tony-zyh 于 2018-3-9 08:06 编辑
hessen 发表于 2018-3-8 17:37
你用VBA代码生成后填入动态库设置即可,若需远程请留下QQ,并增加远程支持币费用

QQ:84783477  生成DLL文件会报错。
hessen

2018-3-8 17:37:29

本帖最后由 hessen 于 2018-3-9 09:26 编辑

你用VBA代码生成后填入动态库设置即可,若需远程请留下QQ
电话/微信:18049989370 QQ:857188287
tony-zyh

2018-3-8 13:59:08


谢谢!,不好意思现在才看到,您看可否远程协助一下,不胜感激!
希望能够远程帮我解决,VBA还不会啊。
本帖最后由 hessen 于 2018-2-27 19:24 编辑

请先参考http://bbs.kuaibiao.cn/forum.php?mod=viewthread&tid=4285
电话/微信:18049989370 QQ:857188287
本帖最后由 hessen 于 2018-3-7 14:05 编辑

biaoqianpiliangdayin.gif

  1. Public Sub ButtunClick(sender As Object, e As SpreadsheetGear.Windows.Co**ols.ShapeActionEventArgs) Implements Interfaces.IExcelWorkBook.ButtunClick
  2. ActiveWorkbook.WorkbookSet.GetLock()
  3. Dim dr As Integer
  4. If e.Shape.Name = "Button Select" Then
  5. ActiveWorkbook.Worksheets("标签打印").Select()
  6. End If
  7. If e.Shape.Name = "Button Copy" Then
  8. dr = (Int(ActiveWorkbook.Worksheets("固定资产档案").Range("T_358").RowCount / 3) + 1) * 6 + 6
  9. ActiveWorkbook.Worksheets("标签打印").Range("A7:F" & dr & "").EntireRow.Delete()
  10. ActiveWorkbook.Worksheets("标签打印").Range("A1:F6").AutoFill(destination:=ActiveWorkbook.Worksheets("标签打印").Range("A1:F" & dr & ""), autoFillType:=AutoFillType.FillDefault)
  11. Dim x, y, m As Integer
  12. Dim a1, a2 As String
  13. m = 9
  14. For x = 6 To dr - 6 Step 6
  15. For y = 0 To 5 Step 2
  16. a1 = AW.ActiveWorksheet.Cells(x, y).Address
  17. a2 = AW.ActiveWorksheet.Cells(x, y + 1).Address
  18. ActiveWorkbook.Worksheets("标签打印").Range(a1 + ":" + a2).Merge()
  19. ActiveWorkbook.Worksheets("标签打印").Cells(x + 1, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 0).Value
  20. ActiveWorkbook.Worksheets("标签打印").Cells(x + 2, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 1).Text
  21. ActiveWorkbook.Worksheets("标签打印").Cells(x + 3, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 2).Value
  22. ActiveWorkbook.Worksheets("标签打印").Cells(x + 4, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 5).Value
  23. ActiveWorkbook.Worksheets("标签打印").Cells(x + 5, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Cells(m, 10).Value
  24. 'ActiveWorkbook.Worksheets("标签打印").Cells(x + 6, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Range("F_3970").Cells(0, 0).Text
  25. 'ActiveWorkbook.Worksheets("标签打印").Cells(x + 7, y + 1).Value = ActiveWorkbook.Worksheets("固定资产档案").Range("F_3970").Cells(0, 0).Text
  26. m = m + 1
  27. Next y
  28. ActiveWorkbook.Worksheets("标签打印").Cells(x + 6, 0).RowHeight = 27
  29. Next x
  30. End If
  31. ActiveWorkbook.WorkbookSet.ReleaseLock()
  32. End Sub '按钮/标签点击事件
复制代码

电话/微信:18049989370 QQ:857188287
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则  允许回帖邮件提醒楼主

快表软件是国内较早研究表格类软件开发平台的团队之一,迄今已有十多年的行业经验.致力于为企事业单位提供实用可靠的数字化平台。
  • 微信公众号

  • 微信小商店

  • 微信客服

  • Powered by Discuz! X3.4 | Copyright © 2022-2024, XiRong Soft. | 快表软件
  • 沪ICP备13033196号 | 营业执照 |上海西戎软件科技有限公司|沪公网安备31011502002146号|沪ICP备13033196号 |