Link to home
Start Free TrialLog in
Avatar of brothertruffle880
brothertruffle880Flag 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
ASKER CERTIFIED SOLUTION
Avatar of Ken Butters
Ken Butters
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brothertruffle880

ASKER

Thanks.  One more question:
How would I specify "desktop" or "My documents"?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Help!  
What does WScript.shell mean?  
I'm kind of a newbie on VBA.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial