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

[µo°Ý] ¦p¦óexcel¶}ÀÉ°õ¦æ¦h­Ó¥¨¶°

[µo°Ý] ¦p¦óexcel¶}ÀÉ°õ¦æ¦h­Ó¥¨¶°

§Ú¦³¤@­Óexcel¶}ÀÉ´N·|¦Û°ÊŪ¨úªº¥¨¶°¡A¦ý§ÚÁÙ¦³¥t¤@­Ó¥¨¶°¤]¬O·Q­n¶}Àɶ]¡A¦ý¬O¬O¶]¦b¨ä¥L¥¨¶°¤§«á(³Ì«á­±)¡A½Ð°Ý§Ú¸Ó¦p¦ó¦w´¡ ??

Sub AUTO_OPEN()

With ActiveSheet
        If .AutoFilterMode Then .AutoFilterMode = False
        If .FilterMode Then .ShowAllData
End With
    sq = Sheets("11").Cells(3, 2)
    Worksheets("AA").Select
    Worksheets("AA").Range("A1:F56").ClearContents
    sqlstr = sq
    resultArr = VBADataXfer.GetSQLResult("XXX", sqlstr, True, "XXXX")
    Call xferToWorksheet(resultArr, "AA", "A1")
   ' Cells.WrapText = False
    Worksheets("AA").Select
   
   
    With ActiveSheet
        If .AutoFilterMode Then .AutoFilterMode = False
        If .FilterMode Then .ShowAllData
End With
    sq = Sheets("11").Cells(4, 2)
    Worksheets("BB").Select
    Worksheets("BB").Range("A1:F51").ClearContents
    sqlstr = sq
    resultArr = VBADataXfer.GetSQLResult("XXX", sqlstr, True, "XXXX")
    Call xferToWorksheet(resultArr, "BB", "A1")
   ' Cells.WrapText = False
    Worksheets("AA").Select

End Sub


¤U­±¬O±ý³Ì«á°õ¦æªº¥¨¶°

Sub ¶×¥X()
°O¿ý ActiveSheet.Shapes(Application.Caller).TextFrame.Characters.Text, [CCC!L3]
  Dim xR As Range, XSHT As Worksheet, xArea As Range
  Dim uFile$, uBook As Workbook, uSht As Worksheet, uPath$
  Dim T1$, T2$, T3$, i&
  uPath = ThisWorkbook.Path
  If [F4] <> "" Then uPath = [F4]
  If Right(uPath, 1) <> "\" Then uPath = uPath & "\"
  If Dir(uPath, vbDirectory) = "" Then MsgBox "§ä¤£¨ì«ü©w¸ô®|¡I": Exit Sub
  Application.ScreenUpdating = False
  On Error Resume Next
  For Each xR In Range([B2], [B65536].End(xlUp))
      T1 = xR: T2 = xR(1, 2): T3 = xR(1, 3)
      If xR.Row < 2 Or T1 = "" Or T2 = "" Or T3 = "" Then GoTo 101
      Set XSHT = Nothing: Set XSHT = ThisWorkbook.Sheets(T1)
      If XSHT Is Nothing Then xR(1, 4) = "§ä¤£¨ì¡G" & T1: GoTo 101
      uFile = uPath & T2
      If Dir(uFile) = "" Then xR(1, 4) = "§ä¤£¨ì¡G" & T2: GoTo 101
      Set uBook = Nothing: Set uBook = Workbooks(T2)
      If uBook Is Nothing Then Set uBook = Workbooks.Open(uFile)
      Set uSht = Nothing: Set uSht = uBook.Sheets(T3)
      If uSht Is Nothing Then xR(1, 4) = "§ä¤£¨ì¡G" & T3: uBook.Close: GoTo 101
      uSht.Activate
      uSht.Unprotect "111" '¸Ñ°£¤u§@ªí«OÅ@(±K½X¦Û¦æ¥[¤J)
      uSht.UsedRange.Clear
      Set xArea = XSHT.UsedRange: xArea.Copy
      With uSht.Range(xArea.Address)
          .PasteSpecial xlPasteFormats
          .PasteSpecial xlPasteValues
          .Replace "", "^^^", Lookat:=xlWhole
          .Replace "^^^", "", Lookat:=xlWhole
          .Columns(2).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
      End With
      uSht.Protect "111" '«ì´_¤u§@ªí«OÅ@(±K½X¦Û¦æ¥[¤J)
      Application.CutCopyMode = False
      uBook.Close SaveChanges:=True
      xR(1, 4) = "¡Õ¶×¥X§¹¦¨¡Ö"
101: Next
  On Error GoTo 0
  [F2] = Now: Beep '°O¿ý¶×¥X¤é´Á¤Î®É¶¡¡Aµo¥XbeepÁn´£¥Üµ²§ô  
  MsgBox "¶×¥Xok¡I"
  End Sub

¶¶«K·Q°Ý¤@¤U¤U¦C¨â­ÓÀu¥ý©Ê?
ThisWorkbook
Sub AUTO_OPEN()

TOP

        ÀR«ä¦Û¦b : ¦n¨Æ­n´£±o°_¡A¬O«D­n©ñ±o¤U¡A¦¨´N§O¤H§Y¬O¦¨´N¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD