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

[µo°Ý] EXCEL VBA¸ô®|°ÝÃD

[µo°Ý] EXCEL VBA¸ô®|°ÝÃD

½Ð±Ð¦U¦ì
¤p§Ì¦b¦Û­qªí³æ¤¤°µ¤F¤@­Ócommandbutton¨Ã¥B«ü©wµ{¦¡¦p¤U:
  1. Private Sub CommandButton1_Click()
  2. ChDir "\\Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù"
  3.    On Error GoTo myLINE
  4.     myFile = Application.GetSaveAsFilename
  5.     Exit Sub
  6. myLINE:
  7.     MsgBox "¤w¨ú®ø"
  8. End Sub
½Æ»s¥N½X
¥D­n¬O¥Î¨Ó§Ö³t«ü¦V©T©wªº¦sÀɦì¸m¡÷"Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù"
¦ý¬O¦³®É­Ô¸ô®|·|¦Û¤v¶]±¼Åܦ¨«ü¦V¨ì®à­±
½Ð°Ý¬O§_¦³¸Ñ?

¦^´_ 1# minture3

¸Õ¸Õ¬Ý
  1. Sub test()
  2.     With Application.FileDialog(msoFileDialogFolderPicker)
  3.         .InitialFileName = "\\Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù"
  4.         .Show
  5.         '§ä¥X¸ô®|
  6.         On Error GoTo myLINE
  7.         myFile = .SelectedItems(1)
  8.     End With
  9.     Exit Sub
  10. myLINE:
  11.     MsgBox "¤w¨ú®ø"
  12. End Sub
½Æ»s¥N½X
PKKO

TOP

¦^´_ 1# minture3

§A¦³®É­Ô·|«ü¦V®à­±ªº­ì¦]¬O¦]¬°,±z­ì¥»«ü©wÀx¦s¦ì¸mªº³o¦æµ{¦¡½X§¹¥þ¨S¥Î¨ì

¥L¤º«Øªº«ü©wÀx¦s¦ì¸m¬°(³Ì«á¤@¦¸¥t¦s·sÀɪº¦ì¸m)
PKKO

TOP

¥»©«³Ì«á¥Ñ minture3 ©ó 2015-4-16 16:16 ½s¿è

¦^´_ 2# PKKO
·PÁ¦^ÂÐ!!
¨Ì±z©Ò¥H´£¨Ñªºµ{¦¡½X±o¨ìªº·|¬O³o­Ó



myFile = .SelectedItems(1)
½Ð±Ð³o¤@¬qªº·N«ä¬O?

myFile = Application.GetSaveAsFilename

¤£¹L§Ú§Æ±æ±o¨ìªº¬O

1.png (87.76 KB)

1.png

TOP

½Ð±Ð³o¤@¬qªº·N«ä¬O?
myFile = .SelectedItems(1)
§Ú¦³¸ÕµÛ§â¥L§ï¦¨¥H¤U³o¬q
myFile = Application.GetSaveAsFilename
¤£¹L·|Åܦ¨¥ý¥X²{¤W¹Ïªº¹ï¸Ü®Ø¨ú®ø«á¦b¥X²{¤U¹Ïªº¹ï¸Ü®Ø
¤£¹L§Ú§Æ±æ±o¨ìªº¬O¥u¦³¤U¹Ï³o­Ó

TOP

¦^´_ 5# minture3

¸Õ¸Õ¬Ý
   myFile =Application.GetSaveAsFilename( "\\Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù")
PKKO

TOP

¦^´_ 6# PKKO

myFile =Application.GetSaveAsFilename
Àɮתº¸ô®|¦n¹³¬O¹ï¤F ¦ý¬OÂI¤FÀx¦s¤§«á ÀɮרèS¦³¦s¶i¥h

­è­è³æ¿W¸Õ¤F¤@¤UApplication.GetSaveAsFilename
·|¼u¥X¥t¦sªº¹ï¸Ü®Ø
¦ý¬O«ö¤FÀx¦s¤§«á ¨Ã¨S¦³­È«¬Àx¦sªº°Ê§@~~
¤£ª¾¹D¬O¤£¬O§Ú¥Îªk¦³»~
  1.   Private Sub CommandButton10_Click()
  2.     Application.GetSaveAsFilename
  3. End Sub  
½Æ»s¥N½X

TOP

¦^´_ 1# minture3

chdir ¦b windows 7 ¤W·|¦³ÂI°ÝÃD, «á¨Ó§Ú³£§ï¥Î API ¨Ó«ü©w

Private Declare Function SetCurrentDirectoryA Lib "kernel32" (ByVal lpPathName As String) As Long

SetCurrentDirectoryA "\\Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù"

TOP

¦^´_ 7# minture3


    §Ú¥H¬°§Aª¾¹D¥Îªk

myFile =Application.GetSaveAsFilename( "\\Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù")

³o¦æµ{¦¡½X¥u¬O¥Î¨Ó§i¶D§A:¥t¦s·sÀɪº¦ì¸m¥H¤ÎÀɮצWºÙ

¨Ã¤£·|¹ê»Ú¤W¯uªº°õ¦æ¥t¦s·sÀɪº°Ê§@

©Ò¥H§A»Ý­nªºµ{¦¡½X¦p¤U

    myFile = Application.GetSaveAsFilename("\\Nsa310\¦ô»ù³Æ¥÷\³Æ-¹q¸£¦ô»ù")
    ActiveWorkbook.SaveAs myFile & "xlsx"'¤~¥iÀx¦s¦Ü§A«ü©wªºÀɮצì¸m,«á­±ªº"xlsx"¬OEXCEL°ÆÀɮצWºÙ,§A¤]¥i¥H´«¦¨"xls","xlsm"
PKKO

TOP

¦^´_ 9# PKKO

·PÁÂPKKO
  1. If Application.GetSaveAsFilename("\\Nsa310\¦ô»ù³Æ¥÷\CWCO\³Æ-¹q¸£¦ô»ù\") Then
  2. Dim myName As String
  3. Sheets("µ¡").Select
  4. myName = Range("AB4") & "-" & Range("AB5") & "-" & Range("AB6")
  5. ActiveWorkbook.SaveAs Filename:=myName, FileFormat:=xlExcel8, Password:="1273"
  6. Else
  7. MsgBox ("¤w¨ú®ø")
  8. End If
½Æ»s¥N½X
°ò¥»¤W¥\¯à®t¤£¦h±µªñ§Ú­nªº¤F
¤£¹L©_©Çªº¬O°õ¦æ³o¤@¦æ®É
Application.GetSaveAsFilename ("\\Nsa310\¦ô»ù³Æ¥÷\CWCO\³Æ-¹q¸£¦ô»ù\")
¥i¥H«ü©w¦sÀɪº¸ô®|
¤£¹L¥L¤@©w·|¼u¥X³o­Óµøµ¡

¤£ºÞ«ö½T©wÁÙ¬O¨ú®ø³Ì«áÁÙ¬O¾a³o¦æ¥t¦sÀÉ®×
ActiveWorkbook.SaveAs Filename:=myName, FileFormat:=xlExcel8, Password:="1273"
ÁöµM±µªñ§Ú­nªº¤F ¤£¹L·Pı´N¬O©Ç©Çªº!!~

2.png (74.09 KB)

2.png

2.png (74.09 KB)

2.png

TOP

        ÀR«ä¦Û¦b : ¤Hªº¤ß¦a¬O¤@²¥¥Ð¡A¤g¦a¨S¦³¼½¤U¦nºØ¤l¡A¤]ªø¤£¥X¦nªºªG¹ê¡C -
ªð¦^¦Cªí ¤W¤@¥DÃD