Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2011, 08:04 PM
b0x4it b0x4it is offline Relative path to desktop Windows 7 32bit Relative path to desktop Office 2010 32bit
Advanced Beginner
Relative path to desktop
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default Relative path to desktop

How can I define the relative path to current user's desktop folder and to the document folder itself?

sorry for asking lots of questions!
Reply With Quote
  #2  
Old 05-18-2011, 11:09 PM
macropod's Avatar
macropod macropod is offline Relative path to desktop Windows 7 32bit Relative path to desktop Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi b0x4it,

Try:
Code:
Sub Demo()
MsgBox Environ("USERPROFILE") & "\Desktop"
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-18-2011, 11:11 PM
b0x4it b0x4it is offline Relative path to desktop Windows 7 32bit Relative path to desktop Office 2010 32bit
Advanced Beginner
Relative path to desktop
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

thank you, what about the current document folder?
Reply With Quote
  #4  
Old 05-18-2011, 11:35 PM
macropod's Avatar
macropod macropod is offline Relative path to desktop Windows 7 32bit Relative path to desktop Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For the 'My Documents' folder, you should be able to replace "\Desktop" with "\My Documents".

For the current document, it's:
MsgBox ActiveDocument.Path
(for a new unsaved document this will be empty)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-18-2011, 11:50 PM
b0x4it b0x4it is offline Relative path to desktop Windows 7 32bit Relative path to desktop Office 2010 32bit
Advanced Beginner
Relative path to desktop
 
Join Date: May 2011
Posts: 95
b0x4it is on a distinguished road
Default

thank you very much
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative path to desktop Instant Search syntax for relative dates eagleeye Outlook 1 05-16-2011 03:58 PM
Relative path to desktop Saving to Desktop from MSWord greeninmexico Word 1 01-05-2011 08:30 PM
Cross reference - full vs relative context macron Word VBA 0 12-02-2010 08:54 PM
Relative path to desktop CHALLENGE! Issue sorting data containing relative references on a separate tab lax828 Excel 3 01-07-2010 11:28 AM
attaching (relative,logical or virtual) path to template word document wissam Mail Merge 0 08-04-2009 05:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft