Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Inside a folder, I have several workbooks that are linked. I have
recorded a macro to open them in sequence and it works fine, but I does not work if I move the whole folder. The code I use is - Workbooks.Open Filename:= _ "xxx:xxx.xls" How can I fix this? Is there a solution that will travel with the location of the folder? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is your macro in the same folder as the other workbooks ?
If yes, you cld use something like this. Workbooks.Open (ThisWorkbook.Path & "\" & "xxx.xls") If No, You need to provide a way for the macro to knw where the files are stored. Mulitple ways to do this. Try the foll below. Sub FolderPath() Dim FolderDestn As String With Application.FileDialog(msoFileDialogFolderPicker) If .Show = -1 Then FolderDestn = .SelectedItems(1) Else FolderDestn = vbNullString End If End With Workbooks.Open (FolderDestn & "\" & "xxx.xls") End Sub HTH, -- Tausif Mohammed "Geri" wrote: Inside a folder, I have several workbooks that are linked. I have recorded a macro to open them in sequence and it works fine, but I does not work if I move the whole folder. The code I use is - Workbooks.Open Filename:= _ "xxx:xxx.xls" How can I fix this? Is there a solution that will travel with the location of the folder? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Universal time | Excel Programming | |||
Set up Universal Macro | Excel Programming | |||
Universal formulas for any given row | New Users to Excel | |||
Universal procedure for changes | Excel Programming | |||
Universal Macro | Excel Programming |