I have a macro that creates a new folder based on a cell reference then saves specific worksheets as PDFs. When I run the macro it creates the folder and saves the PDFs. When anyone else uses the workbook and runs the macro it creates the folder but then saves the PDF onto their H drive (personal area). Why would this be happening?
Hi Netty,
Workbook is password protected. Can't open it.
Regards
Phil
Sorry the password is: Evaluation
I think the pdf export part needs a defined path
Worksheets("Successful Letter").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"SuccessfulLetter.pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Should be
Worksheets("Successful Letter").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
SavePath & "SuccessfulLetter.pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Thank you for all your previous help with this. I've just tried that. Unfortunately it creates the folder and saves the PDFs but not into that newly created folder.
One of the really annoying things that can take ages to sort out - the missing back slash at the end of the savepath
savepath = "f:BSS BIPRResearch ShareHighways" & NameOfRoute & ""
It might work with out the defined part in the pdf export but i would keep it in to make sure its correct
That was brilliant and fixed the problem a treat. However I'm afraid I need to pick your brains again.
I passed the workbook on to the team that use it and they were super happy. Then....today I get a call: it's not working. For some reason, for certain users it trips up saving the sheets as PDFs, but not at the same place. One of the ladies shared her screen and showed me a couple of times. The first time it created the folder with the route name, saved the award report and the successful bidder but then tripped when saving the unsuccessful letter. The second time it created the folder but tripped from the very first save as pdf section and so didn't save anything at all.
The ladies colleague has used it and it was doing the same thing but when he shared his screen with me and did a couple of trial runs it worked every time.
I've attached a screenshot of the error. Does anything occur to you?
The only adjustment they have made was to add an additional password to the workbook to prevent anyone from being able to mess with the addresses listed in the workbook.
I'm really sorry to keep pestering you after the amazing help you have given me.
Simular issue i think.
First of all, i think you should get rid of ' ChDir ("G:BSS BIPRResearch ShareHighways" & NameOfRoute)' as this shouldnt be needed as we are defining the path
then in this part
Worksheets("Unsuccessful Letter Temp").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"UnsuccessfulLetter " & Bidder & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Add in the savepath
Worksheets("Unsuccessful Letter Temp").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
SavePath & "UnsuccessfulLetter " & Bidder & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Test this and let me know how you get on
Purfleet I really appreciate all the help you've given me. Sorry to keep bending your ear, I've only got the dog here during the day so it's quite difficult not being in an office environment and being able to bounce ideas off someone who knows what I'm talking about. I'd get a bit of a shock if the dog ever actually responded to one of my frequent "WHY?"s 🙂
I'd already done what you said with the SaveAs before I sent them the workbook for the team to use. I tested it extensively with several colleagues and all was wonderful. I hadn't taken out the ChDir so I will try that.
The first thing the team who use it did was to add another password to the workbook, so you now have 2 passwords to get into the thing. I don't know whether that has put a spanner in the works. I've asked them to remove the second password and then see if that helps so fingers crossed. I am just a tad miffed that they'd fanny around with the thing as soon I'd passed it over to them.
Hi Netty,
Please don't click the Quote button, it just duplicates the previous post. Use the Add Reply button instead.
Thx
Phil
Maybe the password is conflicting with one of the updates the code is doing. Definitely get it tested without the password and then if it works, we can look to add it back in.
Luckily, Jack (in my avatar) is far too think to answer any of my questions, but he does know exactly when its dinner time