I added CODE tags to your macro - you can use the [#] icon to insert the CODE and /CODE tags to paste your macro between

1. It'd help if you said which line was getting the error

2.


P = "C:\Users" & Environ("Username") & "\Desktop\tempfile.html"



should probably be (added slash after Users)

P = "C:\Users\" & Environ("Username") & "\Desktop\tempfile.html"