How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Richard Your Own Question

Richard
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 16835
Experience:  Over 15 year experience resolving Microsoft Office Issues
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

I would like to have the code for creating a "save as" in a

Resolved Question:

I would like to have the code for creating a "save as" in a specific file folder on my server. Example our user is working on a spreadsheet, when they click the button, it opens the "save as" dialogue box, and the file folder location is a default, that I have setup on the server.
Submitted: 10 months ago.
Category: Microsoft Office
Expert:  Bryan replied 10 months ago.

JBryan42 :

Welcome to JustAnswer. My name is XXXXX XXXXX X will be assisting you today. Please do not rate this session until it has been completed.

JBryan42 :

Are you asking how to replicate that functionality in your own code? Or a shortcut to activate that function? I'm not exactly sure what you're asking for.

Customer :

Sorry, I thought the question was going to Richard, who has been helping me recently. Here is the scenario, I have a spreadsheet open, that has a button control "Save as". I need to have the button perform a command, that opens the "Save as" dialogue box, but instead of the default path being, where the file was originated, I need to specify a file folder on my server, where I want the spreadsheet saved. Does that make any more sense?

Customer :

I do not have the code written for this command, so if I am understanding your question, I am looking for the shortcut to activate the button.

Customer :

Sorry, I thought the question was going to Richard, who has been helping me recently. Here is the scenario, I have a spreadsheet open, that has a button control "Save as". I need to have the button perform a command, that opens the "Save as" dialogue box, but instead of the default path being, where the file was originated, I need to specify a file folder on my server, where I want the spreadsheet saved. Does that make any more sense?





5:26 PM



I do not have the code written for this command, so if I am understanding your question, I am looking for the shortcut to activate the button.



JBryan42 :

Yes, that does make perfect sense. I can give you the code, but seeing that Richard has been helping you, I would prefer to let him have your question unless he opts out. Is that okay with you?

Customer :

That would be great, thank you.

JBryan42 :

No problem at all. Take care. And if Richard needs to opt out for any reason, I'll be happy to take over for him.

Customer :

Do I need to do anything on my end, or will the question be reassigned, so he will pick up where you and I have left it?

JBryan42 :

No need for you to do anything. He will pick it up at his end and you will get an email as soon as he does.

Expert:  Rachel-Mod replied 10 months ago.

Hello,

I'm Rachel, and I’m a moderator for this topic. I sent your requested professional a message to follow up with you here, when they are back online.

If I can help further, please let me know. Thank you for your continued patience.

Best,

Rachel

Expert:  Richard replied 10 months ago.
Hi There,

The code for this is below

Sub t()


Dim IntialName As String
Dim fileSaveName As Variant

fileSaveName = Application.GetSaveAsFilename(InitialFileName:="C:\temp", _
fileFilter:="Excel Files (*.xls), *.xls")

End Sub


In my example, c:\temp is the save as location default

If you have any difficulties at all, please do not hesitate to let me know so I can assist you further

Thank you
Customer: replied 10 months ago.

The code opens up the correct folder, where I want to save to, but I need to keep the same file name, as originally opened. The code provided changes the name to whatever I put in quotations.

Expert:  Richard replied 10 months ago.
ok, then use my code below.

You set the file name for the variable FileName

Sub JA()

Dim IntialName As String
Dim fileSaveName As Variant
InitialDrive = "c:\test\"
Filename = "test.xlsx"

fileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitialDrive & Filename, _
fileFilter:="Excel Files (*.xlsx), *.xlsx")


End Sub

Let me know if you have any difficulties please

Customer: replied 10 months ago.

I am not explaining very well. Let me try again:


Scenario: I open a file named: "Estimate_08272013.xlsm" from a folder on my local drive.


 


I make the necessary changes to the file, and then click on the command button_142


 


What I am looking for is:


1) I need to save it in a different folder, on my server - ***The code provided is doing this part**


2) I need the filename to be the same as the original "Estimate_08272013.xlsm" - ***The code as written, is currently changing the name - to a variable name, not the desired result***

Expert:  Richard replied 10 months ago.
Thanks,

Then use this code please

Sub JA()

Dim IntialName As String
Dim fileSaveName As Variant
Dim objClassOnly As Excel.Application

Set objClassOnly = GetObject(, "Excel.Application")

InitialDrive = "c:\test\"
Filename = objClassOnly.ActiveWorkbook.Name

fileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitialDrive & Filename, _
fileFilter:="Excel Files (*.xlsx), *.xlsx")


End Sub



Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 16835
Experience: Over 15 year experience resolving Microsoft Office Issues
Richard and 3 other Microsoft Office Specialists are ready to help you
Customer: replied 8 months ago.

Richard,


Sorry to bother you again, on this question, but I just noticed that this is not actually saving the file. When I click on the control button, it does open the "Save as" dialoque box, and has the proper name in the file name box, but when I click "Save" it closes the dialoque box, but is not saving the file, to the specified folder, and/or any other folder, for that matter. I have checked to ensure it was not saving to a temp folder, by chance.

Expert:  Richard replied 8 months ago.
Is it possible to look at your file?
Customer: replied 8 months ago.


Yes, if you will send me the link, again. Do you want me to upload the excel file?

Expert:  Richard replied 8 months ago.
yes, and tell me where the button is to run the code please

- Click the following link: http://www.wikisend.com
- Upload the file to that website
- Once it is uploaded, the resulting page will display a "File ID" number.
- Please, give me that "File ID Number"
Customer: replied 8 months ago.

File No. 522060

Expert:  Richard replied 8 months ago.
Can you tell me where the button is to run the code please
Expert:  Richard replied 8 months ago.

Its ok, I found it

 

Use this version please

 

<a href="http://ge.tt/4zy37uw/v/0?c">http://ge.tt/4zy37uw/v/0?c</a>

 

Let me know if you have any difficulties please
Customer: replied 8 months ago.

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Expert:  Richard replied 8 months ago.
The editor took out some of the code, which is why I uploaded it for you.

http://ge.tt/4zy37uw/v/0?c
Customer: replied 8 months ago.


Richard, that code works, but I have realized a different issue with the code. As mentioned above, in this thread, the user needs to be able to open an existing file (example: 10013_Joe_Doe.xltm) and then click on the control button #142 which opens the "Save As" dialoque box, and the default file name, remains the same 10013_Joe_Doe.xltm.


 


As the code is currently written, that works, but what the user needs to be able to do, is modify the file name, by only changing the number associated with it (ie. 10013), they would change the file to 13157_Joe_Doe.xltm for example. As the code is written, it does not allow you to modify that name.


 


I have attached a flow chart of how the user would open the template file, modify it and save it as a quote, and then open the quote file, and modify it, click on the control button #142, and change the number on the file name, and save it in the desired file folder. Hope this makes sense, and is possible. Thanks

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Expert:  Richard replied 8 months ago.
ok, for this requirement,

Change the code

ActiveWorkbook.SaveAs

to

ActiveWorkbook.SaveAs fileSaveName

then it saves it as the file name the users set in the save as box.

Customer: replied 8 months ago.

Richard I change the code, but receive a runtime error '1004, I have attached the screen shots below. Also, once I click on the control button, the first dialoque that comes up, is that "you cannot save a VB Project in a macro-free workbook" I noticed that the file extensions within the code, show .xlsm. I need to maintain the macro enabled workbook, when the user saves the file, but I do not want it saved as a macro-enabled template file.


Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Expert:  Richard replied 8 months ago.
You have to save it as a xlsm else it will stip out the Macros.

No way around this.

Use my version which works please

http://ge.tt/51yILvw/v/0?c


JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
< Last | Next >
  • http://ww2.justanswer.com/uploads/JS/jstinehelfer/2012-6-6_215146_Pictureofme1.64x64.png jstinehelfer's Avatar

    jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
  • http://ww2.justanswer.com/uploads/JA/JasonJames122/2011-12-16_135647_jasonjamesheadshotweb.64x64.jpg JasonJames122's Avatar

    JasonJames122

    Computer Enthusiast

    Satisfied Customers:

    0
    I manage all information systems (network of Windows PC's and servers with Microsoft Office products) for a small business
  • http://ww2.justanswer.com/uploads/JE/jessmagz/2012-6-6_18129_jm.64x64.jpg Jess M.'s Avatar

    Jess M.

    Computer Support Specialist

    Satisfied Customers:

    301
    Computer Software Specialist for more than 10 years
  • http://ww2.justanswer.com/uploads/CH/chutz747/2011-11-6_14231_me.64x64.jpg The-PC-Guy's Avatar

    The-PC-Guy

    Computer Manager

    Satisfied Customers:

    274
    20 years experience providing remote computer support
  • http://ww2.justanswer.com/uploads/SP/spherrod/2012-6-6_174244_1000852.64x64.JPG Steve Herrod's Avatar

    Steve Herrod

    Computer Support Specialist

    Satisfied Customers:

    125
    Trained in Microsoft Office from 2000 through to latest version 2010.
  • http://ww2.justanswer.com/uploads/SE/Seashore2011/2011-12-6_33418_111205223015.64x64.jpg Chris L.'s Avatar

    Chris L.

    Support Specialist

    Satisfied Customers:

    124
    Certified Expert with over 10 years experience.
  • http://ww2.justanswer.com/uploads/KR/krkljatorm/2012-6-24_153417_ITMiro.64x64.jpg IT Miro's Avatar

    IT Miro

    Computer Scientist

    Satisfied Customers:

    97
    Bachelor's Degree in Information Technology, Microsoft Certified Professional