troubleshooting Question

VBA - Opening Workbooks - Specifying a location

Avatar of brothertruffle880
brothertruffle880Flag for United States of America asked on
Microsoft Excel
6 Comments4 Solutions346 ViewsLast Modified:
In the following procedure, how would I specify opening a workbook in the location "My documents" or "Desktop"  

How about specifying a location in a server where:
the full name is:  "x:\users\acctg\Payable\data\summary.xlsx"
but the name as seen in "My computer" is merely x:\
Do I need to type out the full path?  
There must be  a efficient way to refer to drive locations.  No?  Or am I wrong?



Sub add_worksheet()

Dim target As String
Dim wb As Workbook

    target = "d:\summary.xlsx"
    Set wb = Workbooks.Open(target)
    wb.Worksheets.Add after:=wb.Worksheets("sheet1")
    wb.Save
    wb.Close

End Sub
ASKER CERTIFIED SOLUTION
Ken Butters

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros