TkdKidSnake
Active Member
- Joined
- Nov 27, 2012
- Messages
- 255
- Office Version
- 365
- Platform
- Windows
Hi all,
Can you help me, I am trying to create a folder called "JJS Submission Docs" on a users desktop however the use is not defined and then save the particular file in this folder as an xlsx file instead of the original xlsm as I do not want the macros in the newly saved version. What I have so far is below but unfortunately it doesn't work:
If anyone can help me with this it would be greatly appreciated.
Many thanks.
Can you help me, I am trying to create a folder called "JJS Submission Docs" on a users desktop however the use is not defined and then save the particular file in this folder as an xlsx file instead of the original xlsm as I do not want the macros in the newly saved version. What I have so far is below but unfortunately it doesn't work:
VBA Code:
Sub SaveToDeskTop()
Application.DisplayAlerts = False
Dim usrnme As String
Dim myFolderName As String
Dim myFileName As String
'Get username
usrnme = Environ("username")
Sheets("Level 3 PPAP Requirements").Select
ActiveSheet.Unprotect
Range("G4").Select
Selection.Copy
Range("I1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("G6").Select
' Build folder name with today's date
myFolderName = Environ("username") & "\JJS Submission Docs\"
' Check to see if folder name exists already. If not, create it
If (Dir(myFolderName, vbDirectory)) = "" Then MkDir myFolderName
' Build file name - the filename is in cell i1 on tab Level 3 PPAP Requirements"
myFileName = Range("i1") & ".xlsx"
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=False
Sheets("1. PSW").Select
' Save file
ActiveWorkbook.SaveAs Filename:=myFolderName & "\" & myFileName, _
FileFormat:=51, CreateBackup:=False
Application.DisplayAlerts = True
End Sub
If anyone can help me with this it would be greatly appreciated.
Many thanks.