SaveAs

  • Thread starter brownti via OfficeKB.com
  • Start date
B

brownti via OfficeKB.com

Here is my code. The problem is with the saveas command. It doesnt work.
When i click the button i want it to ask where to save as, with the initial
file name to be "proj". Any ideas?

Private Sub CommandButton1_Click()
Dim est As String, mgr As String, sls As String, build As String, _
proj As String, file As Variant
build = builder
mgr = manager
sls = sales
est = estimator
proj = project
file = proj & ".xls"
Range("est") = UCase(est)
Range("o_est") = UCase(est)
Range("mgr") = UCase(mgr)
Range("o_mgr") = UCase(mgr)
Range("sales") = UCase(sls)
Range("o_sales") = UCase(sls)
Range("builder") = UCase(build)
Range("o_builder") = UCase(build)
If Residential = True Then
Call reset_species
End If
Application.GetSaveAsFilename (file)
Unload Me
End Sub
 
G

Guest

GetSaveAsFilename allows you to get a filename from the user, but it does not
actually save the file. Replace this line:

Application.GetSaveAsFilename (file)

with these 2 lines:

file = Application.GetSaveAsFilename (file)
if file<>"False" then application.saveas file
 
B

brownti via OfficeKB.com

That didnt quite work. It doesnt like the last part of it, application.
saveas file


Vergel said:
GetSaveAsFilename allows you to get a filename from the user, but it does not
actually save the file. Replace this line:

Application.GetSaveAsFilename (file)

with these 2 lines:

file = Application.GetSaveAsFilename (file)
if file said:
Here is my code. The problem is with the saveas command. It doesnt work.
When i click the button i want it to ask where to save as, with the initial
[quoted text clipped - 23 lines]
Unload Me
End Sub
 
A

Andrew Taylor

SaveAs is a method of the Workbook class, so it should be

ActiveWorkbook.SaveAs file



That didnt quite work. It doesnt like the last part of it, application.
saveas file





Vergel said:
GetSaveAsFilename allows you to get a filename from the user, but it does not
actually save the file. Replace this line:
Application.GetSaveAsFilename (file)
with these 2 lines:
file = Application.GetSaveAsFilename (file)
if file<>"False" then application.saveas file
Here is my code. The problem is with the saveas command. It doesnt work.
When i click the button i want it to ask where to save as, with the initial
[quoted text clipped - 23 lines]
Unload Me
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top