Thread: Macro Problem
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
albertmb albertmb is offline
external usenet poster
 
Posts: 81
Default Macro Problem

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