View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
RichardSchollar RichardSchollar is offline
external usenet poster
 
Posts: 196
Default VB Code for a directory

Yes it will.

Richard

On 25 Jan, 10:41, Marie Bayes
wrote:
That's great, thanks Bob. I presume this will work for Saveas. too?



"Bob Phillips" wrote:
Workbooks.Open ThisWorkbook.Path & Application.PathSeparator & Workbook.Name


--
---
HTH


Bob


(change the xxxx to gmail if mailing direct)


"RichardSchollar" wrote in message
oups.com...
Hi Marie


You need the following where you have the workbook open statement:


Workbooks.Open ThisWorkbook.Path & "\" & YourWorkbookName


Then this will always open the file named "YourWorkbookName" in the
same directory as the workbook that holds the macro code.


Hope this helps!


Richard


On 25 Jan, 08:13, Marie Bayes
wrote:
Hi
Is there any code I can put into my macro (which opens a file) that will
always look for the file in the 'current' directory, ie, the directory
that
the original file was opened in, so that if I move the directory it will
always find it?
Thanks in advance- Hide quoted text -- Show quoted text -