Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Using cell data as file name

I've created a template for financial analysis and approval for my
sales force. One of the fields is a Quote Reference in which the user
can input any data that they want. The objective being that they begin
the process with a financial analysis, deliver the analysis for
approval, and provide a quote using the same data and Quote Reference.

I'd like to be able to use the data in the Quote Reference field as the
filename and create a button that will automatically use that data to
name the file when clicked.

I'm a complete noob to VBA, but otherwise quite experienced with most
other aspects of Excel. Is there a way to make this happen (easily for
a noob)?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Using cell data as file name

This is just demo code:

Sub button_maker()
ActiveSheet.Buttons.Add(249.75, 204, 66.75, 53.25).Select
Selection.OnAction = "saveit"
End Sub



Sub saveit()
Dim dirname As String, fname As String
dirname = "C:\Documents and Settings\Owner\Desktop"
ChDir dirname
fname = Cells(2, 2).Value
ActiveWorkbook.SaveAs Filename:=dirname & fname
End Sub



For the demo, I assume that the filename is stored in cell B2. Run
button_marker to create the button and assign the button macro. When the
button is pressed, the saveit macro, assuming Quote Reference is cell B2,
saves the sheet using the contents of B2 as the filename.
--
Gary's Student
gsnu200701


"huntnpeck" wrote:

I've created a template for financial analysis and approval for my
sales force. One of the fields is a Quote Reference in which the user
can input any data that they want. The objective being that they begin
the process with a financial analysis, deliver the analysis for
approval, and provide a quote using the same data and Quote Reference.

I'd like to be able to use the data in the Quote Reference field as the
filename and create a button that will automatically use that data to
name the file when clicked.

I'm a complete noob to VBA, but otherwise quite experienced with most
other aspects of Excel. Is there a way to make this happen (easily for
a noob)?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Using cell data as file name

Thanks for this. Though I've still not got it working, (I gather my
unfamilarity with VBA is showing)

I have added a button and named it, saveit (it was 'CommandButton1',
though I'm not certain that the button text has anything whatsoever to
do with the subroutine "saveit"

The actual cell that the data resides in in my sheet is F3, so I
changed "Cells(2,2).Value" to "Cells(6,3).Value"

I also changed the path in "dirname= "C:\Documents and
Settings\Owner\Desktop" to the actual path I want the file to save to.

What does the subroutine "button_maker()" do? and what do the numbers
in the parenthesies mean?, i.e., (249.75, 204, 66.75, 53.25)

Thanks,

Huntnpeck

Gary''s Student wrote:
This is just demo code:

Sub button_maker()
ActiveSheet.Buttons.Add(249.75, 204, 66.75, 53.25).Select
Selection.OnAction = "saveit"
End Sub



Sub saveit()
Dim dirname As String, fname As String
dirname = "C:\Documents and Settings\Owner\Desktop"
ChDir dirname
fname = Cells(2, 2).Value
ActiveWorkbook.SaveAs Filename:=dirname & fname
End Sub



For the demo, I assume that the filename is stored in cell B2. Run
button_marker to create the button and assign the button macro. When the
button is pressed, the saveit macro, assuming Quote Reference is cell B2,
saves the sheet using the contents of B2 as the filename.
--
Gary's Student
gsnu200701


"huntnpeck" wrote:

I've created a template for financial analysis and approval for my
sales force. One of the fields is a Quote Reference in which the user
can input any data that they want. The objective being that they begin
the process with a financial analysis, deliver the analysis for
approval, and provide a quote using the same data and Quote Reference.

I'd like to be able to use the data in the Quote Reference field as the
filename and create a button that will automatically use that data to
name the file when clicked.

I'm a complete noob to VBA, but otherwise quite experienced with most
other aspects of Excel. Is there a way to make this happen (easily for
a noob)?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Update of Dropdown List Box data Rajat Excel Worksheet Functions 4 March 8th 12 05:09 PM
Using cell data as file name huntnpeck Excel Discussion (Misc queries) 1 January 12th 07 10:33 PM
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
.csv file Multiple columns of data in single Cell Bin Excel Discussion (Misc queries) 1 March 29th 06 08:48 PM
open a non-office file using cell data from excel dcauldwell Excel Discussion (Misc queries) 2 January 16th 06 03:04 PM


All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"