PDA

View Full Version : Tell VBA script to look for info in a cell



watery
02-12-2008, 07:14 AM
I have a macro which opens up files in specified folders. At the moment the filepath to the folder is hard scripted which is very annoying if the folder is moved. Is there a way of re writing the macro so that it looks at a cell for the filepath? That way it would only require changing one bit of info rather than dozens and dozens of occurences within the script.

Thanks.

thomaspatton
02-12-2008, 11:08 AM
using the code you have, set a variable :

Dim OpenThis As String
OpenThis = "CellReference"

Then, you can change the cell reference to call the Variable using OpenThis.

Bob Phillips
02-12-2008, 12:00 PM
Or you could a file dialog to alow the user to browse to the directory.