Macro Problem
If you are wanting to save the new workbook in the same folder as the
original you could try using Thisworkbook.Path instead.
Sub Copy2()
ActiveWorkbook.Save
Sheets(Array("Ships", "Phoenicia", "Salvo Grima", "Hotels", "Hard Rock", _
"Corinthia Flight Cat", "Airest", "La Salita - Arches", "Lemongrass
Imported", _
"Lemongrass Local")).Copy
ChDir ThisWorkbook.Path
ActiveWindow.Close
End Sub
"albertmb" wrote:
Hi Everyone.
I do not know how to write a Macro, but I find it convenient to record one
when I need it. I encountered a problem on recording the following Macro:
Sub Copy2()
'
' Copy2 Macro
' Macro recorded 21/09/2008 by Albert Bartolo
'
'
ActiveWorkbook.Save
Sheets("Ships").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets(Array("Ships", "Phoenicia", "Salvo Grima", "Hotels", "Hard Rock", _
"Corinthia Flight Cat", "Airest", "La Salita - Arches", "Lemongrass
Imported", _
"Lemongrass Local")).Select
Sheets("Lemongrass Local").Activate
Sheets(Array("Ships", "Phoenicia", "Salvo Grima", "Hotels", "Hard Rock", _
"Corinthia Flight Cat", "Airest", "La Salita - Arches", "Lemongrass
Imported", _
"Lemongrass Local")).Copy
ChDir "C:\Documents and Settings\Bartolo\Desktop\Quotations\Archive"
ActiveWindow.Close
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("Ships").Select
End Sub
If I copy the folder I am using this macro in, onto a pendrive or to another
computer it does not work. I realised that the problem is the ChDir, which I
marked in bold. Is there a possibility to modify the Macro so as it can work
on any computer.
Thank You
Albert
|