Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lee Lee is offline
external usenet poster
 
Posts: 33
Default SaveCopyAs method

I am trying to save a copy of a workbook with name and
save it in the same directory as the current workbook. My
problem is that Excel is saving it in the default
directory, My Documents. I know in Access, I would use
application.currentproject.path, but this doesn't seem to
be an option in Excel.

Here is the code I have so far:

Dim strClient As String
strClient = Application.InputBox("Enter client name")
ActiveWorkbook.SaveCopyAs strClient & " " & "Raw
Sample.xls"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default SaveCopyAs method

Lee,

add the path to the command

ActiveWorkbook.SaveCopyAs "C:\myExcel\" & strClient & " " & "Raw Sample.xls"
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Lee" wrote in message
...
I am trying to save a copy of a workbook with name and
save it in the same directory as the current workbook. My
problem is that Excel is saving it in the default
directory, My Documents. I know in Access, I would use
application.currentproject.path, but this doesn't seem to
be an option in Excel.

Here is the code I have so far:

Dim strClient As String
strClient = Application.InputBox("Enter client name")
ActiveWorkbook.SaveCopyAs strClient & " " & "Raw
Sample.xls"




  #3   Report Post  
Posted to microsoft.public.excel.programming
Lee Lee is offline
external usenet poster
 
Posts: 33
Default SaveCopyAs method

Thanks for the reply. However, I should have added that
the path will not always be the same. The file will be
saved to a LAN directory folder that will vary from
project to project. That's why I didn't want to hard code
the path.
-----Original Message-----
Lee,

add the path to the command

ActiveWorkbook.SaveCopyAs "C:\myExcel\" & strClient & " "

& "Raw Sample.xls"
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Lee" wrote in

message
...
I am trying to save a copy of a workbook with name and
save it in the same directory as the current workbook.

My
problem is that Excel is saving it in the default
directory, My Documents. I know in Access, I would use
application.currentproject.path, but this doesn't seem

to
be an option in Excel.

Here is the code I have so far:

Dim strClient As String
strClient = Application.InputBox("Enter client

name")
ActiveWorkbook.SaveCopyAs strClient & " " & "Raw
Sample.xls"




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default SaveCopyAs method

Lee,

It doesn't have to be hard-coded. I was juts trying to show that you could
pre-pend it. Somewhere you have to determine what that path is, so you can
save that to a variable and use that.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Lee" wrote in message
...
Thanks for the reply. However, I should have added that
the path will not always be the same. The file will be
saved to a LAN directory folder that will vary from
project to project. That's why I didn't want to hard code
the path.
-----Original Message-----
Lee,

add the path to the command

ActiveWorkbook.SaveCopyAs "C:\myExcel\" & strClient & " "

& "Raw Sample.xls"
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Lee" wrote in

message
...
I am trying to save a copy of a workbook with name and
save it in the same directory as the current workbook.

My
problem is that Excel is saving it in the default
directory, My Documents. I know in Access, I would use
application.currentproject.path, but this doesn't seem

to
be an option in Excel.

Here is the code I have so far:

Dim strClient As String
strClient = Application.InputBox("Enter client

name")
ActiveWorkbook.SaveCopyAs strClient & " " & "Raw
Sample.xls"




.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SaveCopyAs method

Dim strClient As String
Dim sPath as Path
sPath = ActiveWorkbook.Path
if right(sPath) < "\" then sPath = sPath & "\"
strClient = Application.InputBox("Enter client name")
ActiveWorkbook.SaveCopyAs sPath & _
Trim(strClient) & " Raw Sample.xls"

--
Regards,
Tom Ogilvy


"Lee" wrote in message
...
I am trying to save a copy of a workbook with name and
save it in the same directory as the current workbook. My
problem is that Excel is saving it in the default
directory, My Documents. I know in Access, I would use
application.currentproject.path, but this doesn't seem to
be an option in Excel.

Here is the code I have so far:

Dim strClient As String
strClient = Application.InputBox("Enter client name")
ActiveWorkbook.SaveCopyAs strClient & " " & "Raw
Sample.xls"






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
Savecopyas without password Ray Clark[_2_] Excel Discussion (Misc queries) 9 July 3rd 08 12:50 AM
SaveCopyAs with a twist Rookie 1st class Excel Discussion (Misc queries) 5 January 21st 07 12:33 AM
SaveCopyAs Mark Worthington Excel Programming 4 February 8th 04 06:00 AM
SaveCopyAs macro Baddad007 Excel Programming 1 December 31st 03 12:26 AM
SaveCopyAs - Userform disappears mohsinb[_2_] Excel Programming 1 November 6th 03 04:02 PM


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