Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-03-2025, 09:04 AM
Logit Logit is offline Copy or Move Files Windows 10 Copy or Move Files Office 2007
Expert
Copy or Move Files
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Here is a completely reworked version of the macro that successfully works :

Code:
Option Explicit

Sub myMacro()

Dim myFile As Object
Set myFile = CreateObject("Scripting.FileSystemObject")
Call myFile.CopyFile("C:\Users\logit\OneDrive\Desktop\Excel Repair\WinZip Registration.txt", "C:\Users\logit\OneDrive\Desktop\", True)

End Sub

Sub killFile()

Dim killFile As String
killFile = "C:\Users\logit\OneDrive\Desktop\Excel Repair\WinZip Registration.txt"

 Dim Msg As String, Title As String
  Dim Config As Integer, Ans As Integer
  Msg = "Are You Sure ?"
  Msg = Msg & vbNewLine & vbNewLine
  Msg = Msg & "Changes Cannot Be Undone."
 
  Title = "File Delete Critical !"
  Config = vbYesNo + vbCritical
  Ans = MsgBox(Msg, Config, Title)
  If Ans = vbYes Then
    If Len(Dir$(killFile)) > 0 Then
    SetAttr killFile, vbNormal
      Kill killFile
      Else
    MsgBox "File Not Found"
    End If
  End If
  
  If Ans = vbNo Then Exit Sub

End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dragging a selection to copy it, not to move it wardw Word VBA 2 11-28-2019 11:09 AM
VBA Word - Search Within Files Containing A String - Copy Files to New Folder jc491 Word VBA 0 01-09-2016 12:00 PM
Copy or Move Files copy and move not working inventorgeorge Word 8 07-09-2012 03:59 PM
Hyperlink i Word: Copy-paste, and move eradem Word 0 10-01-2011 03:50 AM
Copy or Move Files don't move/copy...., where? Yumin Word 1 04-04-2010 08:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft