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

[µo°Ý] ºô¸ôªÚ¾F¤¤ ­ì¥D¾÷¸ô®|À³¦p¦ó¤U»yªk?

[µo°Ý] ºô¸ôªÚ¾F¤¤ ­ì¥D¾÷¸ô®|À³¦p¦ó¤U»yªk?

¦V¤j¤j¥ý¶i­Ì¨D±Ï:
      ­ì¥»¦b¦Û¤v¥D¾÷¥ÑA1.xls ªí³æ¶}±ÒA2.xls  ¨S°ÝÃD
     Private Sub UserForm_Initialize()
              Dim Path1, str1, str2 As String
              Path1 = Application.ActiveWorkbook.Path
              Set wb = ActiveWorkbook
              wb.Activate
              ChDrive Split(Path1, ":")(0)
              ChDir Path1
              Dim FileName As Variant
              Dim xlfileName As String
              FileName = Path1 & "\" & "A2.xls"
              xlfileName = Dir(FileName)
              If IsOpen(xlfileName) Then
                    Workbooks(xlfileName).Activate
                    Set wb1 = Workbooks(xlfileName)
             Else
                    Set wb1 = Workbooks.Open(FileName, True, False)
             End If
             wb.Activate
     End Sub
    ¦]±¡¶Õ»Ý­n»Ý±N¦¹A1.xls  ¸m¤Jºô¸ôªÚ¾F¤¤  ¥Ñ²Ä¤G®à¹q¶}A1.xls  
    µ²ªG §ì¤£¨ì A2.xls  
   §Úª¾¹D¬Opath1¤§°ÝÃD
   À³¦p¦ó³]©w   FileName = " ¥D¾÷¤@" ªº Path1 & "\" & "A2.xls"  ????
  ·íµM¥H¤U©Ò¶}ªº WordÀÉ¥ç¦bºô¸ôªÚ¾F¤¤ ¸ô®|À³¦p¦ó¤U»yªk
    Set appWD = CreateObject("Word.Application")
    With appWD
        .Visible = True
        .ChangeFileOpenDirectory Path1 & "\"
        .Documents.Open FileName:="A4¦X¨Ö¦C¦L(3X5).doc"
        .WindowState = wdWindowStateNormal
        .Run "A4¦X¨Ö¦C¦L(3X5)!upPrint1" '°õ¦æ³o¥¨¶°
'        .Quit SaveChanges:=False      'Ãö³¬Word
    End With
ÁÂÁ¨ó§U  ¦³ÂI¤ß«æ  ¸U¤À·P¿E
    Set appWD = Nothing
End Sub

¦^´_ 1# yangjie
"\\¥D¾÷¹q¸£¦WºÙ\¦@¥Î¸ê®Æ§¨" & "\" & "A2.xls"

TOP

¦^´_ 2# stillfish00

½Ð°Ý¤j¤j
¥i§_¥ÎVBA ¦p¦ó¥ý¦Û¦æÀò±o¹q¸£¦WºÙ???
¥B¥»¨­¥ç¦³®É¤]­n¶}A1 ¥h¥´¶}A2

TOP

¦^´_ 3# yangjie
¦P¤@¦@¥Î¸ê®Æ§¨¤¤ªº A2.xls ¸ô®|
ThisWorkbook.Path & Application.PathSeparator & "A2.xls"

¦³°ÝÃDªº¤£¬Opath1§a
³o¦æ¤~¦³°ÝÃD : ChDrive Split(Path1, ":")(0)

TOP

½Ð±Ðstillfish00:
·í  A1.xls  ¡A  A2.xls   ³£©ñ¦b¥D¾÷1ªººô¸ôªÚ¾F¤¤¦@¨É
¥Ñ°Ï°ìºô¸ô¥D¾÷2  ¥h¥´¶}  A1.xls  
Sub UserForm_Initialize()
              Path1 = Application.ActiveWorkbook.Path
              Set wb = ActiveWorkbook
              wb.Activate
              FileName = Path1 & "\" & "A2.xls"
              xlfileName = Dir(FileName)
              If IsOpen(xlfileName) Then
                    Workbooks(xlfileName).Activate
                    Set wb1 = Workbooks(xlfileName)
             Else
                    Set wb1 = Workbooks.Open(FileName, True, False)
             End If
°ÝÃD¤@:¦¹  path1§ì±o¨ì¥D¾÷1 ¤¤ªº  A2.xls (¥Ñ¥D¾÷2) ¶Ü
              ¦¹  path1¦³§tºô¸ôªÚ¾F¤¤ªºDrive¶Ü?
°ÝÃD¤G:   FileName =ThisWorkbook.Path & Application.PathSeparator & "A2.xls"
             ¦³§tºô¸ôªÚ¾F¤¤ªºDrive¶Ü?

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2014-2-20 17:06 ½s¿è

¦^´_ 5# yangjie
ºô¸ôªÚ¾F¤¤ªºDrive

³o¬O¬Æ»ò??  §A¬O«üºô¸ôºÏºÐ¾÷¶Ü??
¦pªG¦³³]©wºô¸ôºÏºÐ¾÷¡A  .path ¬O·|¥]§tºÏºÐ¾÷¥N¸¹

TOP

¥»©«³Ì«á¥Ñ yangjie ©ó 2014-2-27 21:27 ½s¿è

¦^´_ 6# stillfish00


    ÁÂÁ ¤w¸Ñ¨M
®³±¼ ChDrive Split(Path1, ":")(0) §Y¥i

TOP

        ÀR«ä¦Û¦b : °µ¸Ó°µªº¨Æ¬O´¼¼z¡A°µ¤£¸Ó°µªº¨Æ¬O·Mè¡C
ªð¦^¦Cªí ¤W¤@¥DÃD