Jane90
Jane90

Reputation: 37

Excel Userform, Save to Desktop

I have a userform that a lot of different users will open and complete. I want the userform to save to each individual user's desktop once they have submitted their answer.

After a message box pops up, the workbook should ideally save to the user's desktop and close. This is what I have so far though it doesn't seem to work:

answer3 = MsgBox("Please transfer $" & variable & " to:" & vbCr & "BSB: XXX-XXX" & vbCr & "Account Number: XXXX XXXX" & vbCr & "Account Name: XXX XXX")
ThisWorkbook.SaveAs((CreateObject("WScript.Shell").specialfolders("Desktop"))
ThisWorkbook.Close

Any idea, how to achieve this ?

Thanks

Upvotes: 1

Views: 876

Answers (1)

The Gambill
The Gambill

Reputation: 181

Well I hate to tell you this but you are actually there except for a couple extra parenthesis... this line should be like this

ThisWorkbook.SaveAs CreateObject("WScript.Shell").specialfolders("Desktop")

You only put parenthesis around your parameters for your objects when you are setting them as a declared variable object like you did for answer3.

Upvotes: 1

Related Questions