baldwynward
New Member
- Joined
- Oct 16, 2014
- Messages
- 10
I have a workbook with a macro to save the file with a new name. However I can't seem to save it as a .xlsx - when I go to open it I get a message saying it doesn't recognise the format. And also it opens up as password protected.
My code is:
I'm guessing I'm missing something to do with WriteResPassword but can't see how to put this in the code. I'm also guessing I need to replace .xlsx with FileFormat:=51 but can't work out how to put this in either.
Can anyone help?
Thanks
My code is:
Sub FolderPicker_SaveAs()
'Aug 29, 2014
'file name in cell e6
Sheets("Client Data").Select
Range("d5").Copy
Range("e5").PasteSpecial Paste:=xlPasteValues
Dim fPath
Dim fName
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = True Then
fPath = .SelectedItems(1) & "\"
fName = fPath & Range("e5").Value & ".xlsm"
Call MsgBox(fName, vbInformation, "Save Path")
ThisWorkbook.SaveAs Filename:=fName
Range("e5").Select
Selection.ClearContents
Range("b5").Select
Worksheets("Client Data").Visible = False
Sheets("Questionnaire").Select
End If
End With
End Sub
'Aug 29, 2014
'file name in cell e6
Sheets("Client Data").Select
Range("d5").Copy
Range("e5").PasteSpecial Paste:=xlPasteValues
Dim fPath
Dim fName
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = True Then
fPath = .SelectedItems(1) & "\"
fName = fPath & Range("e5").Value & ".xlsm"
Call MsgBox(fName, vbInformation, "Save Path")
ThisWorkbook.SaveAs Filename:=fName
Range("e5").Select
Selection.ClearContents
Range("b5").Select
Worksheets("Client Data").Visible = False
Sheets("Questionnaire").Select
End If
End With
End Sub
I'm guessing I'm missing something to do with WriteResPassword but can't see how to put this in the code. I'm also guessing I need to replace .xlsx with FileFormat:=51 but can't work out how to put this in either.
Can anyone help?
Thanks