+ Reply to Thread
Results 1 to 29 of 29

Changing the font in multiple files etc.

  1. #1
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Changing the font in multiple files etc.

    Hello,

    I'm hoping that you all might be able to help me. I'm trying to help solve an issue at my workplace. We are a publisher and we often receive Excel files from the authors we work with who would like the charts and graphs they've created to be included in their books. Our current workflow involves manually moving information from Excel to Adobe Illustrator where the files are sized and prepared for print. This is a time consuming and error ridden process. One of the big difficulties involves Calibri. As I'm sure many of you know, this font does not always travel well. If you copy the chart in Excel and paste it into Illustrator the type is turned into a series of random and unusable symbols. So here's the first thing I hope might be possible: running a script to change the font in multiple files simultaneously. I usually change the font to Arial. This is complicated by the fact that the current files we're working with produce a dialogue box when they're first opened "The workbook you opened contains automatic links to information in another workbook", so any automatic function would ideally be able to suppress this dialogue box or automatically select "Ignore Links".

    I thought I had discovered a way to circumvent some of the work. What I would do was use automator to create versions of all the excel files as PDFs. Then I would use an application I have that will automatically outline the type in a series of PDFs. This would allow me to move the chart into illustrator without losing the appearance of the type. However, when I turn Excel files into PDFs the charts and graphs in the Excel files always get ruined. They get cut in half and placed on two separate pages of the PDF. Is there any way to stop this from happening? The fact that you can only open one PDF page at a time in Illustrator makes this nearly useless.

    Anyways, thanks for taking the time to read my post. If you have any advice for solving my issues or where else I might ask for help I'd really appreciate it. For what it's worth, if there is someone that can definitely take on and solve my problem I would be willing to pay for the service.

    Regards,
    sreilly

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    TO make this really simple, can you record a macro of you doing all this to ONE file? The we can take that macro from you and convert it into a looping tool.

    1) Open a blank workbook
    2) Turn on the macro recorder
    3) Now open one of your source files
    4) Make all the changes and save it
    5) Turn off the recorder
    6) post the resulting macro here inside CODE tags.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Hi JBeaucaire,

    Thanks for the response. Please see my code below.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    Looks like that macro is only of step #4 above, can you do it from step 1? I'd get a lot more useful info from the First few steps, too. Thanks.

  5. #5
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Hi,

    As far as I can tell that's pretty much all the code that's being generated. Perhaps I'm not looking in the right place. I've followed the same steps again but have opened the document via the File->Open option in Excel rather than just clicking on the item in Finder. Is this information helpful?

    Please Login or Register  to view this content.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    Yes, very helpful, notice all the additional helpful code at the start? So something like this, I'd think:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Thanks!

    Unfortunately I'm a little unsure how to run this. I have it saved as a Macro in a Workbook. How do I direct it to the files I need to change? If I just open one file and try to run it, it seems like the script runs because a dialogue box opens which says "Done, a total of files were updated" but the font in the document remains unchanged.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    Reading through the comments in the macro you should spot the fPATH at the top of the macro. That is the folder the macro is trying to find files inside to update.

    1) Decide on a single folder where you want this to happen for all
    2) Place all the .xlsx files in that folder
    3) Update the macro to type in that folder address, that will be the "processing" folder.

    You said you'd already installed the macro into a blank workbook, that's great. No need to open anything, just run the macro and it should process all the files found in that folder that end with .xlsx

  9. #9
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    I've double-checked and your instructions are how I have things set up but I'm still getting the same results as before.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    So the macro is unable to find any files in that folder, that implies.

  11. #11
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    I haven't moved the files since I posted the code upthread. Those files are on a server which I thought perhaps could be causing an issue. I copied both the files and the worksheet with the macro to a new folder on my desktop just called "Copy" and changed the file path in the macro to reflect the change. Same issue.

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    May I request you post the edited macro so I can review the changes, check that off the list of causes?

  13. #13
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Please Login or Register  to view this content.
    Image showing code with file path. http://imgur.com/a/oTLKQ

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    Doh! Mybad.

    Fix this line:
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    I've made the edit, still the macro seems to run but doesn't do anything.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 10-03-2016 at 06:06 PM.

  16. #16
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    I added a line of code in red above, add that in and run it, see what the first file found says.

  17. #17
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    "the first filename found was ___________"

  18. #18
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Changing the font in multiple files etc.

    There you go, no filenames are being found in the given folder.

  19. #19
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Right, any chance you can help me figure out why that is? You can see the location of the folder at the bottom of this screenshot.

    http://imgur.com/sHdWSO1

  20. #20
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Changing the font in multiple files etc.

    Hi,

    Since you are testing the extension anyway, I would recommend that you omit the MacID part from the Dir call and simply use
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  21. #21
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Hi xlnitwit,

    Thanks for the suggestion. Making this change had the following impact: when I ran the macro the dialogue box said that the first filename found was _DS._Store__. When I clicked 'ok' the first file in the folder opened but then I got a runtime error- "Run-time error '-2147483645 (800000003)' The specified value is out of range."

  22. #22
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Changing the font in multiple files etc.

    Which line of code is highlighted by the debugger?

  23. #23
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    With ActiveSheet.Shapes("Chart 1").TextFrame2.TextRange.Font<

  24. #24
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Changing the font in multiple files etc.

    Does the active sheet contain a chart object called Chart 1?

  25. #25
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    The workbook with the macro saved in it does not. The first file in the folder I'm trying to run the macro in does. I just checked this by running the vba recorder and seeing what it recorded when I selected the chart. The line produced was " ActiveSheet.ChartObjects("Chart 1").Activate".

  26. #26
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Changing the font in multiple files etc.

    When the error occurs, there should be a workbook open and active. Does its active sheet have a chart by that name?

  27. #27
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    When I run the macro with the first file in the folder open I first get the same dialogue box about ds.store. Then I'm told that file 1.1 is already open so the macro is trying to open the files from the folder. If I select that, yes, I do want to reopen that file then I get the same run time error.

    Edit: and yes, the chart in that file is "Chart 1".
    Last edited by sreilly; 10-05-2016 at 11:34 AM.

  28. #28
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    *bump*

    Can anyone help me out?

  29. #29
    Registered User
    Join Date
    10-02-2016
    Location
    Cambridge, MA
    MS-Off Ver
    Excel for Mac: 14.4.9
    Posts
    16

    Re: Changing the font in multiple files etc.

    Hi,

    Is anyone out there able to offer some advice?

    Thanks


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-02-2015, 09:18 AM
  2. Changing VBA font?
    By balthamossa2b in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2013, 12:01 PM
  3. [SOLVED] Macro to open multiple files with changing names
    By KeithMale in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2013, 07:28 PM
  4. Changing data in multiple files
    By TECHSALES in forum Excel General
    Replies: 1
    Last Post: 08-06-2009, 11:13 PM
  5. Changing Font Color
    By bagoxc in forum Excel General
    Replies: 2
    Last Post: 07-16-2006, 08:20 PM
  6. [SOLVED] code for changing font
    By Jack Sons in forum Excel General
    Replies: 2
    Last Post: 11-22-2005, 02:45 PM
  7. Changing the font color using VBA
    By magoobee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2005, 10:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1