ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¨â­Ó¿W¥ßEXCEL ¦p¦ó±N¹Bºâ§¹ªº¸ê®Æ¦^¶Ç¨ì¥DExcel?

¥»©«³Ì«á¥Ñ quickfixer ©ó 2019-3-15 04:18 ½s¿è

¦^´_ 16# 502243

§A­nªº¤£¬O¦P¤@­Óexcel¶}2­ÓÀɤ¬¶Ç,¦Ó¬O2­Ó¤£¦Pexcel.exe¤¬¶Ç¸ê®Æ,¹ï¶Ü?

°Ñ¦Ò¸ê®Æ¨Ó·½
https://www.mobile01.com/topicdetail.php?f=511&t=4737630&p=1
(#244f)
§Ú¸Õ¹L¤u§@ºÞ²z­û¤£·|´Ý¦sexcel.exe
1.xlsm
  1. Sub test()

  2.     Dim app1 As Object, book1 As Excel.Workbook
  3.     Set app1 = CreateObject("Excel.Application")
  4.     Set book1 = app1.Workbooks.Open(ThisWorkbook.Path & "\" & "2.xlsm")
  5.     app1.Visible = True
  6.    
  7.     Dim sourcedata As Range, targetdata As Range, temp() As Variant
  8.     Set sourcedata = Sheets("a").Range("a1:a5")
  9.     Set targetdata = book1.Sheets("b").Range("a1:a5")
  10.     temp = sourcedata
  11.     targetdata.Value = temp
  12.    
  13.     app1.Run "test"
  14.    
  15.     Set sourcedata = book1.Sheets("b").Range("b1:b5")
  16.     Set targetdata = Sheets("a").Range("c1:c5")
  17.     temp = sourcedata
  18.     targetdata.Value = temp
  19.    
  20.     book1.Close SaveChanges:=False
  21.     app1.Quit
  22.     Set app1 = Nothing
  23.     Set book1 = Nothing
  24.    

  25. End Sub
½Æ»s¥N½X
2.xlsm
  1. Sub test()
  2.    
  3.     For i = 1 To 5
  4.         Sheets("b").Cells(i, 2) = Sheets("b").Cells(i, 1) + Rnd()
  5.     Next i
  6.    
  7. End Sub
½Æ»s¥N½X
excel.zip (24.51 KB)

TOP

¦^´_ 20# 502243


    dim §ï public,¹³ gbkee  #16 ¨º¹³¼g,´N¥i¥H§âÃö³¬©ñ¨ì¥t¤@­Ósub
Public app1 As Object, book1 As Excel.Workbook

TOP

        ÀR«ä¦Û¦b : ºÉ¦h¤Ö¥»¥÷¡A´N±o¦h¤Ö¥»¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD