On Oct 13, 6:51*am, jeff wrote:
On Oct 12, 2:44*pm, p45cal wrote:
Ken;523100 Wrote:
Jeff
Try
Sub Macro2()
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\" &
"Book2.xls"
End Sub
or something along that line.
Ken
There might be a problem with 'ActiveWorkbook.Path' ken.. the
activeworkbook hasn't got a path yet since it's never been saved!
--
p45cal
*p45cal*
------------------------------------------------------------------------
p45cal's Profile:http://www.thecodecage.com/forumz/member.php?userid=558
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=143554
Thanks for the heads up. Good point. What I had planned was to do a
Save prior to this coding just to make sure the path was established.
j.o.- Hide quoted text -
- Show quoted text -
I can get this to copy and paste ok. But, I still can't get it to
save to the same path as the original workbook.
Most of the variations shown below copy and paste ok, but they save
the new workbook in the root directory.
If somebody can show me what I'm doing wrong, I would appreciate it.
Thanks j.o.
Sub Macro3()
Windows("Vehicle gas & main records.xls").Activate
ActiveWorkbook.Save
Sheets("V 2").Select
ActiveSheet.Copy
Dim ActWkbk As Workbook
Set ActWkbk = ActiveWorkbook
' Set ActiveWorkbook = NewWorkbook ' Object Required
'Tried these variations to get it to save as Test.xls in the
' same directory as the original workbook.
' ActWkbk.SaveAs ThisWorkbook.Path & "test.xls"
' this one copies ok, but saves to root as MISCTEST.xls
'ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\" &
"Test.xls"
'copies ok - saves to root as Test.xls
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "Test.xls"
'copies ok - saves to root as Test.xls
' ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "Test.xls"
'copies ok - saves to root as Test.xls
'ThisWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "Test.xls"
'****this will rename original file as Test.xls - it copies data ok
to new file,
' but leaves that as Book*.xls ALSO - file is saved in root
directory.
Windows("Vehicle gas & main records.xls").Activate
Sheets("Menu").Select
End Sub