Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-11-2012, 08:02 PM
macropod's Avatar
macropod macropod is offline can I run a macro when I open a specific doc. Windows 7 64bit can I run a macro when I open a specific doc. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
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 shreked,

You can do that by adding the following code to the document's 'This Document' module:
Code:
Private Sub Document_Open()
Dim StrFold As String
With Application
  StrFold = .Options.DefaultFilePath(wdDocumentsPath)
  With .Dialogs(wdDialogFileOpen)
    .Name = "full path to folder, including final \"
    .Show
  End With
  .ChangeFileOpenDirectory StrFold
End With
End Sub
Note that the code switches the folder opening path back to the default after the dialogue is closed.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I run a macro when I open a specific doc. Macro for highlighting specific number of words icsjohn Word VBA 2 12-07-2011 06:44 PM
can I run a macro when I open a specific doc. Need help extracting specific text from one doument to another with macro/VBA. zsmithku Word 1 04-15-2011 03:46 PM
Macro request: open on event infotech Outlook 0 12-08-2010 06:40 PM
Macro to open template not working Brandi Mail Merge 2 06-24-2010 09:29 AM
Word attachment on an E-mail-macro to open attachment & nablady Outlook 0 11-28-2006 03:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:22 AM.


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