|
-
Aug 31st, 2000, 04:56 PM
#1
Thread Starter
Hyperactive Member
I have a form in excel. I have created a button that will save the file. What is supposed to happen is that the form is supposed to be saved as the "control number" which is in cell A3. How can I save a file that will reference a cell for the file name???
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
-
Aug 31st, 2000, 05:03 PM
#2
Code:
Dim sFileName As String
sFileName = ActiveSheet.Range("C3").Value
ActiveWorkbook.SaveAs sFileName
Good luck!
-
Aug 31st, 2000, 05:10 PM
#3
Thread Starter
Hyperactive Member
for some reason that is not working. What's wrong?
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
-
Aug 31st, 2000, 05:12 PM
#4
Fanatic Member
This code should work:
Code:
Dim sFileName As String
sFileName = ActiveSheet.Range("A3").Value
ActiveWorkbook.SaveAs sFileName
-
Aug 31st, 2000, 05:15 PM
#5
Thread Starter
Hyperactive Member
Ok. I got it to work. It was a formula but I copied and pasted values. One problem. I am using the =NOW() formula for the control number in the Number format. I have it so it will display up to only 5 decimal places. However, when it saves the form, it saves it with like 10 decimal places. How can I keep that from happening? Also, when I used that code it doesn't come up with a dialog box for Save As. It just saves it. Help
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
-
Aug 31st, 2000, 05:23 PM
#6
Thread Starter
Hyperactive Member
That code works but, I need for the Save As dialog box to come up so the user can specify what folder to save it in. How do I do that?
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
-
Aug 31st, 2000, 05:40 PM
#7
Sorry you can't have it both ways.
Either you pass a file name to the SaveAs method, and in that Excel saves the file without prompting, or you don't pass a file name to the method in which case Excel throghs up the Save As dialog so the user can choose a path and a name for the file.
Of course you could call SaveAs without the file name argument let the user set the path and the name and then you rename the file afterwards.
Or call up the "Browse for Folder" dialog so the user can only choose a path and not a name for the file.
See the tips section here at VB-World on how to call this dialog.
Best regards
-
Aug 31st, 2000, 06:10 PM
#8
Thread Starter
Hyperactive Member
I tried the Call SaveAs and it came up with an error. "Sub or Function not defined." what am I doing wrong?
Thanks Alot,
David Gottlieb
CIW Certified Internet Webmaster
Web Developer/Designer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|