Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2011, 03:12 PM
judicial85 judicial85 is offline Macros on other computers Windows 7 Macros on other computers Office 2010 (Version 14.0)
Advanced Beginner
Macros on other computers
 
Join Date: Nov 2010
Posts: 64
judicial85 is on a distinguished road
Default Macros on other computers

Good afternoon!

I have created a series of macros for work that I use to analyze data. I would like to use these Macros on my home computers and my students would like to use them for analysis as well.

The problem is I am getting frustrated with having to go into my Macros and always change:
C:/Users/Danny/Desktop/ to C:/Users/Tina/Desktop/ to C:/Users/Becky/Desktop/ etc. How can I tell the macro C:/Users/ "ANYWHERE" /Deskop/?



Thanks! Bryan

PS - I am self-taught in programming so I don't have a large "tool box".
Reply With Quote
  #2  
Old 03-06-2011, 05:00 PM
macropod's Avatar
macropod macropod is offline Macros on other computers Windows 7 32bit Macros on other computers Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 Bryan,

Depending on what you're doing, it may be as simple as changing the hard-coded file path to:
ActiveDocument.Path
If that doesn't work, you really need to give more details of the code and where the document has been saved to when the macro is run.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 03-06-2011, 06:03 PM
judicial85 judicial85 is offline Macros on other computers Windows 7 Macros on other computers Office 2010 (Version 14.0)
Advanced Beginner
Macros on other computers
 
Join Date: Nov 2010
Posts: 64
judicial85 is on a distinguished road
Default

Thank you Paul! But like I said, I'm fairly weak in VBA and coding... what is the "english translation" of ActiveDocument.Path? I'll look that command up in a dictionary too!

What I was doing was taking a text file off of C:/.../Desktop, importing it, then moving the text file to C:/.../Documents/ and exporting a picture to the desktop at the same time. This works for things like that?
Reply With Quote
  #4  
Old 03-06-2011, 06:57 PM
macropod's Avatar
macropod macropod is offline Macros on other computers Windows 7 32bit Macros on other computers Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 Bryan,
Quote:
Originally Posted by judicial85 View Post
Thank you Paul! But like I said, I'm fairly weak in VBA and coding... what is the "english translation" of ActiveDocument.Path?
ActiveDocument.Path is a vba expression that returns the path to the active document. It is especially useful where you want to work on a file that's kept in the same folder as the document you're working on. Where the file you're working on is in a different, though related, folder, you can add code to strip off the unwanted parts and add on such additional (known) portions that you might need.

ActiveDocument.Path will typically return a string like:
C:/Users/Bryan/My Documents
so, if you wanted:
C:/Users/Bryan/Desktop
you could use the vba Replace command to change 'My Documents' to 'Desktop', and the ActiveDocument.Path expression combined with the Replace command would then work equally well for: C:/Users/Danny/Desktop;
C:/Users/Tina/Desktop; and
C:/Users/Becky/Desktop,
etc.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros on other computers Working with Outlook on 2 Computers Help Aquanut Outlook 8 02-02-2011 09:54 AM
outlook on two home computers dan.myers2229 Outlook 2 09-25-2010 04:10 PM
Macros on other computers Same email address on 2 or 3 computers Bob Newton Outlook 2 08-20-2010 03:34 PM
Macros on other computers Read Email on Three Different Computers silverbullett Office 2 08-19-2009 08:47 AM
Syncing references across multiple computers bremenick Word 0 07-23-2009 10:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:45 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