Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving xls in specific directory

Hi folks,

Is there a way to open an excell file so that when you go to save it it
saves in a specific directory?

ps I am opening this file using the hyperlink function within excel.

thanks
Dave

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Saving xls in specific directory

Dave, do you want to save the file in the same directory it was opened
from or to a standard, default directory or to a directory that the
user chooses?

Alan

David Hodgson wrote:
Hi folks,

Is there a way to open an excell file so that when you go to save it it
saves in a specific directory?

ps I am opening this file using the hyperlink function within excel.

thanks
Dave


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Saving xls in specific directory

Hi alan,

If the hyperlink points to c:\folderA\test.xls, I want excel to save it
in c:\folderB\test.xls. But I only want this to happen for test.xls.

Dave

Alan wrote:
Dave, do you want to save the file in the same directory it was opened
from or to a standard, default directory or to a directory that the
user chooses?

Alan

David Hodgson wrote:
Hi folks,

Is there a way to open an excell file so that when you go to save it it
saves in a specific directory?

ps I am opening this file using the hyperlink function within excel.

thanks
Dave


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Saving xls in specific directory

Trap the BeforeSave event and write it to your specified directory

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\myDir\" & ThisWorkbook.Name
Application.DisplayAlerts = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

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

"David Hodgson" wrote in message
ps.com...
Hi folks,

Is there a way to open an excell file so that when you go to save it it
saves in a specific directory?

ps I am opening this file using the hyperlink function within excel.

thanks
Dave



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Saving xls in specific directory

Dave, the only thing that you may want to add to Bob's code is a test
that you are saving "test.xls" and not another file. Hence ...

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
If ThisWorkbook.Name = "test.xls" Then
Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\myDir\" & ThisWorkbook.Name
Application.DisplayAlerts = True
End If
End Sub

Bob Phillips wrote:
Trap the BeforeSave event and write it to your specified directory

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
Application.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\myDir\" & ThisWorkbook.Name
Application.DisplayAlerts = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

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

"David Hodgson" wrote in message
ps.com...
Hi folks,

Is there a way to open an excell file so that when you go to save it it
saves in a specific directory?

ps I am opening this file using the hyperlink function within excel.

thanks
Dave




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 to root directory ChrisP Excel Discussion (Misc queries) 2 July 31st 06 02:10 AM
Saving file to specific directory sungen99[_75_] Excel Programming 1 February 22nd 06 02:01 PM
Saving into new directory Greg B Excel Discussion (Misc queries) 2 March 2nd 05 03:58 PM
saving/creating a directory Matt B Excel Programming 2 January 19th 04 09:35 PM
Saving to same directory Michael Beckinsale Excel Programming 1 December 12th 03 07:31 PM


All times are GMT +1. The time now is 03:42 AM.

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"