Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Savecopyas without password | Excel Discussion (Misc queries) | |||
SaveCopyAs with a twist | Excel Discussion (Misc queries) | |||
SaveCopyAs | Excel Programming | |||
SaveCopyAs macro | Excel Programming | |||
SaveCopyAs - Userform disappears | Excel Programming |