Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Universal open

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Universal open

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Universal time Joseph Felcon Excel Programming 1 August 29th 07 12:18 AM
Set up Universal Macro Kou Vang[_2_] Excel Programming 1 January 23rd 06 07:50 PM
Universal formulas for any given row lamontd7 New Users to Excel 3 August 1st 05 02:55 PM
Universal procedure for changes Matt Jensen Excel Programming 5 December 29th 04 03:48 PM
Universal Macro Sam Thurston Excel Programming 2 February 21st 04 12:28 AM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"