Solved

Change ThisWorkBook.Path direction

Posted on 2013-01-30
3
388 Views
Last Modified: 2013-02-02
The code snippet below directs a new workbook to c:\tmp

If Dir(ThisWorkbook.Path & "\" & "new.xlsx") = "" Then
        xBook.SaveAs Filename:=ThisWorkbook.Path & "\" & ThisWorkbook.Name & "_" & Format(Now(), "yyyymmdd_hhnnss") & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    Else
        xBook.SaveAs Filename:=ThisWorkbook.Path & "\" & "new.xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    End If

How would this be altered to go to D:\My Documents (windows environment)

And the equivalent in the MAC OS. I don't use MAC and not sure if there is a common directory for docs.

Thanks in advance for any suggestions
0
Comment
Question by:dgd1212
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 47

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
ID: 38837918
On the MAC the directory is 'Documents'.
0
 
LVL 2

Accepted Solution

by:
junholee earned 400 total points
ID: 38838344
0
 

Author Comment

by:dgd1212
ID: 38847207
maybe I am misunderstanding the solution. once the second Workbook is created it should be filed into "My Documents". I'm making the assumption that "My Documents" is the same for XP, and windows 7/8. Not sure how the code should be written to accomplish. Thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question