Solved

Change ThisWorkBook.Path direction

Posted on 2013-01-30
3
378 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
3 Comments
 
LVL 45

Assisted Solution

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

Accepted Solution

by:
junholee earned 400 total points
Comment Utility
0
 

Author Comment

by:dgd1212
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now