Avatar of brothertruffle880
brothertruffle880
Flag for United States of America asked on

VBA - Opening Workbooks - Specifying a location

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
Microsoft Excel

Avatar of undefined
Last Comment
Ken Butters

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ken Butters

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
brothertruffle880

ASKER
Thanks.  One more question:
How would I specify "desktop" or "My documents"?
SOLUTION
Ken Butters

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
brothertruffle880

ASKER
Help!  
What does WScript.shell mean?  
I'm kind of a newbie on VBA.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck