Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Saving Worksheet/Workbook via CommandButton

Thanks,

How do I verify path exist and create it if it does not? I assume an error
code is involved in this part.

Thanks again,
Les

"Bob Phillips" wrote:



"WLMPilot" wrote in message
...
I have a spreadsheet that is controlled by a macro in order to control

cursor
movement. The spreadsheet will be used by users to enter items & qty in
order to restock supplies.

I have a command button with caption "Save and Close Order". I need two
things from someone on this button.

1) Automatic Filename: I wish to create a filename.xls automatically

using
the date the order is placed along with value from B1 (which identifies

the
station, ie 2). The format for the filename I need is yy-mmdd. The

format
for the entire filename is "yy-mmdd ST2 Order" where the number "2", in

this
example, is the value in B1.
I need code to make up this filename when the commandbutton is clicked. I
will add the path for the filename.


Activeworkbook.SaveAs Filename:=Format(Date,"yyyy-mm-ddd") & " ST" &
Range("B1").Value & " Order"

2) Also need the code to actually save and close the workbook.


As above plus

Activeworkbook.Close



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Saving Worksheet/Workbook via CommandButton

Just try and create it, top down

On Error Resume Next
MkDir "C:\myDir"
MkDir "C:\myDir\myTest"
'etc
On Error Goto 0

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"WLMPilot" wrote in message
...
Thanks,

How do I verify path exist and create it if it does not? I assume an

error
code is involved in this part.

Thanks again,
Les

"Bob Phillips" wrote:



"WLMPilot" wrote in message
...
I have a spreadsheet that is controlled by a macro in order to control

cursor
movement. The spreadsheet will be used by users to enter items & qty

in
order to restock supplies.

I have a command button with caption "Save and Close Order". I need

two
things from someone on this button.

1) Automatic Filename: I wish to create a filename.xls automatically

using
the date the order is placed along with value from B1 (which

identifies
the
station, ie 2). The format for the filename I need is yy-mmdd. The

format
for the entire filename is "yy-mmdd ST2 Order" where the number "2",

in
this
example, is the value in B1.
I need code to make up this filename when the commandbutton is

clicked. I
will add the path for the filename.


Activeworkbook.SaveAs Filename:=Format(Date,"yyyy-mm-ddd") & " ST" &
Range("B1").Value & " Order"

2) Also need the code to actually save and close the workbook.


As above plus

Activeworkbook.Close





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
Saving a Worksheet/Workbook with VALUES ONLY CAT Excel Discussion (Misc queries) 4 October 2nd 08 06:50 PM
Saving into 1 workbook as a different worksheet dataman777 Excel Worksheet Functions 0 August 30th 05 11:37 PM
Saving data in a worksheet within a workbook Homeuser Excel Discussion (Misc queries) 2 August 21st 05 10:49 PM
Saving a worksheet out of a workbook Fred Holmes Excel Programming 3 June 15th 04 09:12 PM
Saving one specific worksheet in a workbook budenba Excel Programming 2 October 31st 03 12:31 PM


All times are GMT +1. The time now is 11: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"