• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Macro to save to new folder works for me but not others|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / Macro to save to new folder works for me but not others|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosMacro to save to new folder works f…
sp_PrintTopic sp_TopicIcon
Macro to save to new folder works for me but not others
Avatar
Netty Forster
Member
Members
Level 0
Forum Posts: 10
Member Since:
October 23, 2019
sp_UserOfflineSmall Offline
1
July 29, 2020 - 7:18 pm
sp_Permalink sp_Print

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?

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1517
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
July 29, 2020 - 8:15 pm
sp_Permalink sp_Print

Hi Netty,

Workbook is password protected.  Can't open it.

Regards

Phil

Avatar
Netty Forster
Member
Members
Level 0
Forum Posts: 10
Member Since:
October 23, 2019
sp_UserOfflineSmall Offline
3
July 30, 2020 - 12:44 am
sp_Permalink sp_Print

Sorry the password is:   Evaluation

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
4
July 30, 2020 - 5:09 am
sp_Permalink sp_Print

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

Avatar
Netty Forster
Member
Members
Level 0
Forum Posts: 10
Member Since:
October 23, 2019
sp_UserOfflineSmall Offline
5
July 30, 2020 - 3:22 pm
sp_Permalink sp_Print sp_EditHistory

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.

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
6
July 31, 2020 - 1:08 am
sp_Permalink sp_Print sp_EditHistory

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 BIPR\Research Share\Highways\" & NameOfRoute & "\"

It might work with out the defined part in the pdf export but i would keep it in to make sure its correct

Avatar
Netty Forster
Member
Members
Level 0
Forum Posts: 10
Member Since:
October 23, 2019
sp_UserOfflineSmall Offline
7
August 5, 2020 - 7:55 pm
sp_Permalink sp_Print sp_EditHistory

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. Spreadsheet-error.jpgImage Enlarger

I'm really sorry to keep pestering you after the amazing help you have given me.

sp_PlupAttachments Attachments
  • sp_PlupImage Spreadsheet-error.jpg (69 KB)
Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
8
August 5, 2020 - 11:02 pm
sp_Permalink sp_Print

Simular issue i think.

First of all, i think you should get rid of ' ChDir ("G:\BSS BIPR\Research Share\Highways\" & 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

Avatar
Netty Forster
Member
Members
Level 0
Forum Posts: 10
Member Since:
October 23, 2019
sp_UserOfflineSmall Offline
9
August 6, 2020 - 4:13 am
sp_Permalink sp_Print sp_EditHistory

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.

Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1517
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
10
August 6, 2020 - 8:42 am
sp_Permalink sp_Print

Hi Netty,

Please don't click the Quote button, it just duplicates the previous post.  Use the Add Reply button instead.

Thx

Phil

Avatar
Purfleet
England
Member
Members


Trusted Members
Level 4
Forum Posts: 412
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline
11
August 6, 2020 - 5:54 pm
sp_Permalink sp_Print

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

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Dana Friedt, Shawn Barwick, Nada Perovic, Uwe von Gostomski
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 870
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Sopi Yuniarti
LAFONSO HERNANDEZ
Forum Stats:
Groups: 3
Forums: 24
Topics: 6218
Posts: 27266

 

Member Stats:
Guest Posters: 49
Members: 31901
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.