Referring to another Excel file in a macro

  Chris the Ancient 18:11 01 Apr 04
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 04

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 04

Bear with me while I experiment.

CtA

  Chris the Ancient 18:34 01 Apr 04

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.

Qualcomm Snapdragon 835 benchmarks: Antutu, Geekbench 4, GFXBench and PCMark results

1995-2015: How technology has changed the world in 20 years

This stop-frame animation tells a moving story of domestic violence for Refuge

New iPad 2017 preview: Apple's affordable but underspecced new iPad may appeal to the education…