發表文章

目前顯示的是有「VBA」標籤的文章

VBA 修改指定的檔案名稱

開啟VBA ,插入模組,貼上下面程式碼,修改檔案路徑及舊的檔案名稱及新的檔案名稱 Sub RenameTheFile() '修改指定的檔案名稱     Dim FilePath As String     Dim OldFileName As String     Dim OldFilePath As String     Dim NewFileName As String          ' 設置檔案路徑     FilePath = "C:\YourFilePath\"     ' 設置舊的檔案名稱     OldFileName = "OldFileName.txt"     '設置舊的檔案路徑+名稱     OldFilePath = FilePath & OldFileName     ' 設置新的檔案名稱     NewFileName = "NewFileName.txt"          ' 檢查檔案是否存在     If Dir(FilePath) <> "" Then         ' 修改檔案名稱         Name OldFilePath As Replace(OldFilePath, OldFileName, NewFileName)         MsgBox "檔案名稱修改完成。"     Else         MsgBox "檔案不存在。"     End If End Sub

Excel 刪除所有Autoshapes

圖片
  有時可以找到隱形、透明色、無邊的Autoshape 如何有效地快速刪除 如何確定是Autoshape?! 可以在 常用 -> 尋找與選取 -> 選取窗格 選取窗格 ->選取物件,看選取物件名稱是否是 Autoshape 如何刪除所有Autoshape 可以在 常用 -> 尋找與選取 -> 選取物件及Ctrl+A 可以選取所有物件,但 這方法也會選取圖片 如果要 刪除需要注意 另一方法使用VBA 可以只刪除Autoshapes Sub Delete_All_Shapes() '刪除所有Autoshapes     Dim GetShape As Shape     For Each GetShape In ActiveSheet.Shapes             GetShape.Delete         Next End Sub

VBA 複製資料夾內的所有資料夾(不含檔案)到另一個資料夾內

想要複製資料夾內的所有資料夾,但不含檔案到另一個資料夾內 VBA Copy Folder only to another Folder Sub Copy_Folder()     Dim fs, f, f1, s, sf     Dim xFiDialog As FileDialog     Dim xFiDialog2 As FileDialog     Dim xPath As String, xPath2 As String     Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker)     If xFiDialog.Show = -1 Then         xPath = xFiDialog.SelectedItems(1)     End If     Set xFiDialog = Application.FileDialog(msoFileDialogFolderPicker)     If xFiDialog.Show = -1 Then         xPath2 = xFiDialog.SelectedItems(1)     End If     Set xFiDialog = Nothing     Set fs = CreateObject("Scripting.FileSystemObject")     Set f = fs.GetFolder(xPath)     Set sf = f.SubFolders     For Each f1 In sf         If fs.FolderExists(xPath2 + "\" + f1.Name) Then         s = s & ...

AutoCAD 線 Line 物件方法屬性參考(ActiveX)

要創建一條線,請使用 AddLine 方法。 Methods 方法 ArrayPolar 環形陣列 ArrayRectangular 矩形陣列 Copy 複製 Delete 刪除 GetBoundingBox 包圍物件2點 GetExtensionDictionary 得到擴展字典 GetXData 得到擴充數據 Highlight 設定是否高亮 IntersectWith 相交點 Mirror 鏡射 Mirror3D 3D鏡射 Move 移動 Offset 偏移 Rotate 旋轉 Rotate3D 3D旋轉 ScaleEntity 縮放 SetXData 設定擴充數據 TransformBy 給予4x4轉換矩陣的情況下移動、縮放或旋轉對象 Update 更新 Properties 屬性 Angle 直線角度 Application 應用程式 Delta 直線頂點坐標差值 Document 所屬圖面 EndPoint 終點 EntityTransparency 透明度 Handle 處理碼(句柄) HasExtensionDictionary 是否具有擴展字典 Hyperlinks   Layer 圖層 Length 長度 Linetype 線型 LinetypeScale 線型比例 Lineweight 線粗 Material 材料 Normal 法線向量 ObjectID 物件ID ObjectName 物件類型 Own...