![]() |
|
|
|
#1
|
|||
|
|||
|
Thanks for your reply I was able to figure out a different way to get it to work. I created a new string variable called Docname and made it equal the active workbook.name and was then able to use the if docname like "*Contract*.RTF" to call the find and replace macro. Thanks for your input.
|
|
#2
|
||||
|
||||
|
Unless there's more to what you're doing than you've posted, I can't see where 'the active workbook.name' has any bearing - all you'd mentioned so far is documents, not workbooks.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Below is the code I used I probably didn't explain it very well in my previous post. Included what I did to get the macro to autorun when the filename contains a specific string.
Code:
Private Sub Document_Open()
Call Filename
End Sub
Sub Filename()
Dim Docname As String
Docname = ActiveDocument.Name
If Docname Like "*Contract*" Then
Call contractchange
End If
If Docname Like "*contract*" Then
Call contractchange
End If
End Sub
Sub contractchange()
Dim run As Variant
run = MsgBox("do you want to make changes',vbYesNo)
If run = vbNo Then Exit Sub
If run = vbYes Then "remaining code goes here)
Last edited by macropod; 11-30-2013 at 02:48 PM. Reason: Added code tags |
|
| Tags |
| macros don't work, macros in word, vba word |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Word file type in 2007
|
casaserves | Word | 4 | 08-03-2013 01:11 AM |
can I run a macro when I open a specific doc ??
|
ximpostor | Word VBA | 10 | 10-12-2012 12:35 PM |
Need VBA For Macro On How To Remove Specific Words
|
netchie | Word VBA | 6 | 08-28-2012 03:37 PM |
| can I run a macro when I open a specific doc. | shreked | Word | 8 | 01-12-2012 03:36 AM |
| Getting COMException Incompatible file type and file extension | sbalerao | Mail Merge | 0 | 04-21-2011 10:30 AM |