#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Save as

Ive created a template for my office staff to use to create invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a certain folder
2) and the file name will be the contents of "A1".

Thank You
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Save as

Apply this event macro:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
fileSaveName =
Application.GetSaveAsFilename(InitialFileName:="Ce rtain_path\" & Range("A1"))
End Sub

Replace Certain_path by a real path name!
Post if you need help to install it!

Regards,
Stefi

€ždvya€ť ezt Ă*rta:

Ive created a template for my office staff to use to create invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a certain folder
2) and the file name will be the contents of "A1".

Thank You

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Save as

Help installing would be greatly appreciated.

Thank you very much

"Stefi" wrote:

Apply this event macro:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
fileSaveName =
Application.GetSaveAsFilename(InitialFileName:="Ce rtain_path\" & Range("A1"))
End Sub

Replace Certain_path by a real path name!
Post if you need help to install it!

Regards,
Stefi

€ždvya€ť ezt Ă*rta:

Ive created a template for my office staff to use to create invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a certain folder
2) and the file name will be the contents of "A1".

Thank You

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save as


Rather than direct them to a folder why not just have the workbook save
ther only?
Like this:

Code:
--------------------
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" & (Sheets("Sheet1").Range("A1").Value & ".xls")

--------------------


dvya;248761 Wrote:
Ive created a template for my office staff to use to create invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a certain
folder
2) and the file name will be the contents of "A1".

Thank You



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=69432

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Save as

How would i install this code?

Thank you,

"Simon Lloyd" wrote:


Rather than direct them to a folder why not just have the workbook save
ther only?
Like this:

Code:
--------------------
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" & (Sheets("Sheet1").Range("A1").Value & ".xls")

--------------------


dvya;248761 Wrote:
Ive created a template for my office staff to use to create invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a certain
folder
2) and the file name will be the contents of "A1".

Thank You



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=69432




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save as


You could use a command button or menu item, you could even us it like
this
Code:
--------------------
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" & (Sheets("Sheet1").Range("A1").Value & ".xls")
End Sub
--------------------
or
Code:
--------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" & (Sheets("Sheet1").Range("A1").Value & ".xls")
End Sub
--------------------
you would probably want to use the latter!

dvya;249803 Wrote:
How would i install this code?

Thank you,

"Simon Lloyd" wrote:


Rather than direct them to a folder why not just have the workbook

save
ther only?
Like this:

Code:
--------------------
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" &

(Sheets("Sheet1").Range("A1").Value & ".xls")

--------------------


dvya;248761 Wrote:
Ive created a template for my office staff to use to create

invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a

certain
folder
2) and the file name will be the contents of "A1".

Thank You



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'Save as - The Code Cage Forums'

(http://www.thecodecage.com/forumz/sh...ad.php?t=69432)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=69432

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Save as

Open VBE (Alt+F11)
In the Project Explorer window right click on Thisworkbook under your
workbook name
Select View code from the local menu
Copy and Paste event macro code in the Thisworkbook (Code) window

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
fileSaveName = _
Application.GetSaveAsFilename(InitialFileName:="D: \work\" &
Range("A1") & ".xls")
Application.EnableEvents = False
ThisWorkbook.SaveAs Filename:=fileSaveName
Application.EnableEvents = True
End Sub


I don't know your aspects, but maybe you could consider Simon's suggestion,
it doesn't allow the user change the save path at all.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
ActiveWorkbook.SaveCopyAs "D:\work\" & Range("A1") & ".xls"
Workbooks.Open Filename:="D:\work\" & Range("A1") & ".xls"
ThisWorkbook.Close savechanges:=False
End Sub

Regards,
Stefi

€ždvya€ť ezt Ă*rta:

Help installing would be greatly appreciated.

Thank you very much

"Stefi" wrote:

Apply this event macro:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
fileSaveName =
Application.GetSaveAsFilename(InitialFileName:="Ce rtain_path\" & Range("A1"))
End Sub

Replace Certain_path by a real path name!
Post if you need help to install it!

Regards,
Stefi

€ždvya€ť ezt Ă*rta:

Ive created a template for my office staff to use to create invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a certain folder
2) and the file name will be the contents of "A1".

Thank You

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Save as

I got it working as a command button. Thank you very much!

"Simon Lloyd" wrote:


You could use a command button or menu item, you could even us it like
this
Code:
--------------------
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" & (Sheets("Sheet1").Range("A1").Value & ".xls")
End Sub
--------------------
or
Code:
--------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" & (Sheets("Sheet1").Range("A1").Value & ".xls")
End Sub
--------------------
you would probably want to use the latter!

dvya;249803 Wrote:
How would i install this code?

Thank you,

"Simon Lloyd" wrote:


Rather than direct them to a folder why not just have the workbook

save
ther only?
Like this:

Code:
--------------------
ActiveWorkbook.SaveCopyAs "C:\Users\Simon\Desktop" &

(Sheets("Sheet1").Range("A1").Value & ".xls")

--------------------


dvya;248761 Wrote:
Ive created a template for my office staff to use to create

invoices. Im
looking for a way that when they choose save -
1) the box that opens up will automatically be directed to a

certain
folder
2) and the file name will be the contents of "A1".

Thank You


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'Save as - The Code Cage Forums'

(http://www.thecodecage.com/forumz/sh...ad.php?t=69432)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=69432


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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
Disable save, save as, but allow save via command button TimN Excel Programming 10 September 1st 06 07:05 PM
How to diasble save and save as menu but allow a save button hon123456 Excel Programming 1 June 12th 06 09:50 AM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM
Save As - Multiple Sheets fails to save as text file Ravee Srinivasan Excel Programming 2 November 10th 03 04:05 PM


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