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

[µo°Ý] ¦p¦ó¨ú±o¤v¶}±ÒEXCEL±±¨îÅv,°õ¦æ¥~³¡ÀÉ®×¥¨¶°

[µo°Ý] ¦p¦ó¨ú±o¤v¶}±ÒEXCEL±±¨îÅv,°õ¦æ¥~³¡ÀÉ®×¥¨¶°

½Ð±Ð¤j¤j
ªþÀÉ1 & 2¥Ñ¨â­ÓEXCEL¦U§O¥´¶}«á,
°õ¦æ1.xlsb OpenApp¥¨¶°,¦p¤Uµ{¦¡½X,
Àɮצb¤v¶}±Òªºª¬ºA¤U,¦p¦ó¨ú±o¤v¶}±ÒEXCEL±±¨îÅv?,°õ¦æ2.xlsb´ú¸Õ¥¨¶°

x.rar (21.65 KB)
  1. Private Sub OpenApp()

  2.     On Error Resume Next
  3.     Err.Clear
  4.     Open ThisWorkbook.Path & "\" & 2 & ".xlsb" For Append As #1
  5.     Close #1

  6.     If Err.Number > 0 Then '¦¹¬¡­¶Ã¯¤v³Q¶}±Ò

  7.         '¦¹¬¡­¶Ã¯¤v³Q¶}±Ò,¦¹³B­n¦p¦ó¨ú±o¤v¶}±ÒEXCEL±±¨îÅv?,°õ¦æ´ú¸Õ¥¨¶°
  8.         app1.Run "´ú¸Õ"
  9.     Else
  10.         Set app1 = CreateObject("Excel.Application")
  11.         Set book1 = app1.Workbooks.Open(ThisWorkbook.Path & "\2.xlsb")
  12.         app1.Visible = True

  13.         app1.Run "´ú¸Õ"
  14.     End If

  15.     Set app1 = Nothing
  16.     Set book1 = Nothing
  17. End Sub
½Æ»s¥N½X

§Ú¤v¦bºô¸ô¤W§ä¨ì¸Ñµª ,´£¨Ñµ¹»Ý­nªºªB¤Í
https://tw.answers.yahoo.com/question/index?qid=20090214000016KK01619
  1. Private Sub OpenApp()
  2.     Dim app1 As Object
  3.     On Error Resume Next
  4.     Err.Clear
  5.     Open ThisWorkbook.Path & "\" & 2 & ".xlsb" For Append As #1
  6.     Close #1

  7.     If Err.Number > 0 Then '¦¹¬¡­¶Ã¯¤v³Q¶}±Ò
  8.         Set app1 = CreateObject(ThisWorkbook.Path & "\" & 2 & ".xlsb")
  9.         app1.Application.Run "´ú¸Õ"
  10.   
  11.     Else  '¦¹¬¡­¶Ã¯¥¼³Q¶}±Ò
  12.         Set app1 = CreateObject("Excel.Application")
  13.         Set book1 = app1.Workbooks.Open(ThisWorkbook.Path & "\2.xlsb")
  14.         app1.Visible = True
  15.         app1.Run "´ú¸Õ"
  16.     End If

  17.     Set app1 = Nothing
  18.     Set book1 = Nothing
  19. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD