powercell99
Board Regular
- Joined
- May 14, 2014
- Messages
- 75
I have a macro that is supposed to copy the contents of a SharePoint folder to my C:drive,
But it was crashing and not completing the copying, so i noticed something when i MANUALLY copy and past the folder to my C:Drive; I get 7 Pop up messages that i must click "SKIP" in order to proceed. I think that is whats causing my macro to get hung up and crash, because it doesnt know how to handle the dialog box and Excel is waiting on a user response. The messages are all similar: what code can i add to the macro to instruct it to Choose SKIP when any dialog box appears while its running the macro?
Msg1:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
DispForm.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
---------------------------
Msg2:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Thumbnails.ASPX
Type: ASPX File
Size: 3.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
----------------------------------------
Msg3:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Upload.ASPX
Type: ASPX File
Size: 3.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
-----------------------------------------
Msg4:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Combine.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
-----------------------------------------
Msg5:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Repair.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
-------------------------------------------
Msg6:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
EditForm.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
---------------------------------------------
Msg7:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
AllItems.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
HTML:
Sub CopyWorkbooks()
'Note: If ToPath folder ("C:\Aggregation\") already exist it will overwrite existing files in this folder
'if ToPath does not exist, it will be made for you.
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "//collab.DOUSA.gov/sites/gtomo/bes/mab/ads/trackingsheets/" ' <--- location of the files being copied
ToPath = "C:\Aggregation\" ' <--- location where copied files will be pasted
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
End If
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
FSO.CopyFolder Source:=FromPath, Destination:=ToPath
End Sub
But it was crashing and not completing the copying, so i noticed something when i MANUALLY copy and past the folder to my C:Drive; I get 7 Pop up messages that i must click "SKIP" in order to proceed. I think that is whats causing my macro to get hung up and crash, because it doesnt know how to handle the dialog box and Excel is waiting on a user response. The messages are all similar: what code can i add to the macro to instruct it to Choose SKIP when any dialog box appears while its running the macro?
Msg1:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
DispForm.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
---------------------------
Msg2:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Thumbnails.ASPX
Type: ASPX File
Size: 3.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
----------------------------------------
Msg3:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Upload.ASPX
Type: ASPX File
Size: 3.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
-----------------------------------------
Msg4:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Combine.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
-----------------------------------------
Msg5:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
Repair.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
-------------------------------------------
Msg6:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
EditForm.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items
---------------------------------------------
Msg7:
You need permission to perform this action
You require permission from the computer's administrator to make changes to this file
AllItems.ASPX
Type: ASPX File
Size: 13.29KB
Date modified: 6/3/2014 5:38 PM
Try Again Skip Cancel
Do this for all current items