Referring to another Excel file in a macro

  Chris the Ancient 18:11 01 Apr 2004
Locked

Hoping VoG (with TM) or pc moron are looking in!

I have two excel files in one folder. This folder may be moved from one location to another. This don't half muck up pathnames!

One of the excel files needs to write data into the other file.

However, the macro to write this data across seems to need the full path name of the other file - and that may well change as the folder is moved!

Is there a way of overcoming the need for the full pathname of the other file as I develop the macro?

TIA

Chris

  VoG II 18:20 01 Apr 2004

This approach works of both files are always in the same folder:

Sub Auto_Open()

Dim path As String

path = ThisWorkbook.path ' WaQCoMvb.XLA should be in this directory

Workbooks.Open (path & "\WaQCoMvb.XLA")

Workbooks("WaQCoMvb.XLA").RunAutoMacros
xlAutoOpen

End Sub

  Chris the Ancient 18:26 01 Apr 2004

Bear with me while I experiment.

CtA

  Chris the Ancient 18:34 01 Apr 2004

Of course!

VoG™ - you can go off people that are that clever and quick! ;oP

Again, my thanks for bailing me out of some rather messy brown stuff!

Chris

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Fujitsu Lifebook P727 laptop review

Microsoft Paint set to die after 32 years

Mac power user tips and hidden tricks

Comment désactiver la saisie intuitive et paramétrer votre clavier ?