MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 21st, 2002, 02:47 AM   #1
misterg
Board Regular
 
Join Date: May 2002
Posts: 66
Default

Good morning all,

Just a brief question...is it possible to save a file as the value of a cell?

That is to say, i have a combo box returning text values (names) into a cell.

Can i use VBA coding to save the file as this cell value?

For example, if the combo box returns the name John Smith (and places this value in a cell - incidentally, can i get this placed into a text box? ), can the file then be saved as C:John Smith.xls?

If so...how!

p.s. you will probably notice i slipped in a quick question about populating a text box with the returned value from the combo box...any suggestions on how to do this also would be gratefully recd!

Keeping you busy?

Many thanks

G
misterg is offline   Reply With Quote
Old May 21st, 2002, 03:47 AM   #2
dk
MrExcel MVP
 
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
Default

Morning,

If you want to save the active workbook as the value of the cell in A1 you can just use:-

ActiveWorkbook.SaveAs "C:folder name" & Range("A1").Value

As for the textbox question - is it on a userform or on a worksheet?

Regards,
Dan
dk is offline   Reply With Quote
Old May 21st, 2002, 03:48 AM   #3
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-05-21 01:47, misterg wrote:
Good morning all,

Just a brief question...is it possible to save a file as the value of a cell?

That is to say, i have a combo box returning text values (names) into a cell.

Can i use VBA coding to save the file as this cell value?

For example, if the combo box returns the name John Smith (and places this value in a cell - incidentally, can i get this placed into a text box? ), can the file then be saved as C:John Smith.xls?

If so...how!

p.s. you will probably notice i slipped in a quick question about populating a text box with the returned value from the combo box...any suggestions on how to do this also would be gratefully recd!

Keeping you busy?

Many thanks

G
For the first question use:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ThisWorkbook.SaveAs ("c:" & Range("a1").Value & ".xls")

End Sub

Change A1 to the cell that houses your value.

For the second question, what is the location of the Combobox and Textbox?

__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old May 21st, 2002, 03:50 AM   #4
misterg
Board Regular
 
Join Date: May 2002
Posts: 66
Default

The text box and combo box would be on the same worksheet.

Do you thin they would work better on a userform?

G
misterg is offline   Reply With Quote
Old May 21st, 2002, 03:56 AM   #5
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-05-21 02:50, misterg wrote:
The text box and combo box would be on the same worksheet.

Do you thin they would work better on a userform?

G
No I'd prefer on the sheet (Not being a very confident VBA user)

is:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

TextBox1.Value = Range("A1").Value & ".xls"

End Sub

what you need?
__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old May 21st, 2002, 04:05 AM   #6
misterg
Board Regular
 
Join Date: May 2002
Posts: 66
Default

Mac,

The world is now a much brighter place.

Many thanks for your help...already the grey hairs are diminishing, the bald patch is growing back.

THANKS!!!!

G
misterg is offline   Reply With Quote
Old May 21st, 2002, 04:56 AM   #7
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-05-21 03:05, misterg wrote:
Mac,

The world is now a much brighter place.

Many thanks for your help...already the grey hairs are diminishing, the bald patch is growing back.

THANKS!!!!

G
That's very nice to hear
__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old May 21st, 2002, 05:20 AM   #8
misterg
Board Regular
 
Join Date: May 2002
Posts: 66
Default

Actually, just one more point on this point.

The code works fine if i want to use it at the end of the filename, that is to say if i call the file C:Blah blah & Range("A1").value...

But...how do i do this:

I need to set up individual folders on a shared drive for the respective names in the combo list.

How would i direct a file to be saved in each persons file and differentiate the file names purely by a title and date code?

For example...2 folder names on the shared drive will be John Smith and Peter Smith.

If john Smith is selected from the list I need the file to be saved as S:Sharedjohn SmithPersonal comments (and then date code taken from a cell reference).

So basically that means returning the name selected in the combo box AFTER the path s:Shared...but beforePersonal comments (date).

Does that sound confusing?

Its the same principle as before but instead of putting the name cell reference at the end of the file path, it goes in the middle.

God, im tired now...
G
misterg is offline   Reply With Quote
Old May 22nd, 2002, 04:33 AM   #9
Ian Mac
MrExcel MVP
 
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
Default

Quote:
On 2002-05-21 04:20, misterg wrote:
Actually, just one more point on this point.

The code works fine if i want to use it at the end of the filename, that is to say if i call the file C:Blah blah & Range("A1").value...

But...how do i do this:

I need to set up individual folders on a shared drive for the respective names in the combo list.

How would i direct a file to be saved in each persons file and differentiate the file names purely by a title and date code?

For example...2 folder names on the shared drive will be John Smith and Peter Smith.

If john Smith is selected from the list I need the file to be saved as S:Sharedjohn SmithPersonal comments (and then date code taken from a cell reference).

So basically that means returning the name selected in the combo box AFTER the path s:Shared...but beforePersonal comments (date).

Does that sound confusing?

Its the same principle as before but instead of putting the name cell reference at the end of the file path, it goes in the middle.

God, im tired now...
G
you've pretty much answered your own question.

"S:Shared" & sheet1.range("B1").value & "Personal comments" etc

where B1 house the name you want.
__________________
"Have a good time......all the time"
Ian Mac
Ian Mac is offline   Reply With Quote
Old May 24th, 2002, 07:25 AM   #10
misterg
Board Regular
 
Join Date: May 2002
Posts: 66
Default

Mac,

That works really well, thank you very much.

However, you know me by now...one question is never enough, i always push for more...

Is there anyway to get the date put in at the end of the file name (calling this from a =now()) cell?

I run into problems when i put this cell ref at the end of "Personal comments".

Any cluse how i get around this (the problem is caused by knowing whether to put it before or after the .xls

Can this be worked around?

G
misterg is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:50 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes