+ Reply to Thread
Results 1 to 30 of 30

Read-Only file needs to be Save As to specific folder with Range Name

  1. #1
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Read-Only file needs to be Save As to specific folder with Range Name

    I have to export excel statements that open as a Read-Only file, then save them with the name in cell A1 to a specific folder... I am getting closer I think, but when I try to run the macro the file does not save.... what have I done wrong?? I am using Excel 2010 and want to save to Excel Workbook or Excel 97-2003 Workbook

    Here is my code....

    Please Login or Register  to view this content.
    Thank you!!
    Last edited by Cutter; 07-31-2012 at 06:07 PM. Reason: Added code tags

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    this code will save the workbook as to the path provided in your first post and the cell in A1's value

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    I am sorry I am really new at this, my code should read...

    Please Login or Register  to view this content.
    Last edited by Cutter; 07-31-2012 at 06:08 PM. Reason: Added code tags

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    What does the line

    Please Login or Register  to view this content.
    refer to?

  5. #5
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Nothing... sorry that is from earlier attempts at working on this... it can be removed

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Try deleting all of your code so that it looks like this

    Sub SaveAS()
    '
    Please Login or Register  to view this content.
    Then try running the macro

  7. #7
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    I got a run time error 1004
    Method 'SaveAS' of object'_Workbook'failed

  8. #8
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Can you open an excel document in the path that you are wanting the workbook to be saved an in any cell type

    Please Login or Register  to view this content.
    then tell me what the cell returns?

  9. #9
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    \\mspm1bnas04\westc4\Statements_Sent\Aug\[Ohio Valley Medical Center - 1214715.xlsx]formservlet

  10. #10
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    There's no drive in front of it?
    Try changing it to this

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Now it is just highlighting the cells, nothing else

  12. #12
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    It's not saving the document to the new location specified?

  13. #13
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    No nothing other than highlighting the cells around the active cells at the time of the macro run.

  14. #14
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Okay try this one, sorry.

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Still nothing...

  16. #16
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    what value is in cell A1?

  17. #17
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    The name of the account, which needs to be the name of the workbook when saved.

  18. #18
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Does the name of the account in cell A1 contain any characters that would not be allowed when saving a file name? Such as \ / * ? " < >

  19. #19
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Nope, it looks like this "Dhsc Llc - 1155539" though cell A1 is merge & center from A1-I1... would that make a differance?

  20. #20
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Hmmm, it shouldn't, I tried on my computer and it seems to work fine.

    It has to be something with the filepath that you are supplying.

    Do you have Windows on you computer? If so go to the start menu and select Run. Then from the Run window copy and paste the below path into the open box.

    Please Login or Register  to view this content.
    Then select Okay. This should go to the filepath that you are trying to save your workbook to. Try and find the workbook here.

  21. #21
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Nope, nothing is in the file there... though it does go right to the correct file. When I attempt to run the macro it just highlights the workbook and does nothing else

    Please Login or Register  to view this content.
    Last edited by Cutter; 08-02-2012 at 05:29 PM. Reason: Added code tags

  22. #22
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Is the value in A1 a formula?

  23. #23
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    No just text

  24. #24
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Okay let's try completely readding the code:

    1.Press Alt+F8 on your keyboard
    2.Clear the macro name box and type NewFile in the blank box provided
    3.Select the Create option
    4.In between the Sub NewFile() and End Sub copy and paste the following code:

    Please Login or Register  to view this content.
    Note I changed the xls to xlsm to see if that would make a difference

    5.Exit out of the Visual Basic Window
    6.Press Alt+F8 again and this time select the NewFile macro
    7.Select Run

  25. #25
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Yeah, that got us closer!! The workbook saved with the correct name and to the correct file, but it creates a file within the file, not that it is that big of deal I can work around that, I just want to make sure that when I email the workbook out to other people it will read correctly... can we save without the macro enabled?

  26. #26
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Try altering the code to look like this

    Please Login or Register  to view this content.
    And what did you mean by it creates a file within the file?

  27. #27
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    It saved to the file, but it will not open... I get the filed you are trying to open, is in a different format than specified by the file extension.... I press yes to continute to open the file
    Then I get Macros have been disabled. Macros might contian viruses... I click disable Macros button and get nothing...

  28. #28
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Hmm.. I just get the first message not the second and the workbook comes up. You might just have to save it as the xlsm. Users can still open it they'll just be asked if they want to enable or disable macros.

  29. #29
    Registered User
    Join Date
    07-31-2012
    Location
    Minnapolis
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    Ok, I can work with that.

    Thank you!

  30. #30
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Read-Only file needs to be Save As to specific folder with Range Name

    No problem, sorry I couldn't get it a little farther. Don't forget to mark this thread solved and if I helped maybe give me a little star tap.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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