Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-21-2017, 04:55 AM
gmayor's Avatar
gmayor gmayor is offline VBA Code apply draft Windows 10 VBA Code apply draft Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It certainly does, because it appears to be calling a procedure WriteToBookmarkRange that doesn't exist, and the macro as written also has no idea what cboYourName.Value is.

If you want to write text to a bookmark, you could call the FillBM sub from my web site:
Code:
Public Sub FillBM(strBMName As String, strValue As String)
'Graham Mayor - http://www.gmayor.com
Dim oRng As Range
    With ActiveDocument
        On Error GoTo lbl_Exit
        Set oRng = .Bookmarks(strBMName).Range
        oRng.Text = strValue
        oRng.Bookmarks.Add strBMName
    End With
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub
This will write the value to the named bookmark (here "Draft"), assuming that bookmark exists also. If not it does nothing. e.g.
Code:
If .Bookmarks.Exists("Status") Then FillBM "Draft", Environ("USERNAME")
This inserts the user's name at the bookmark, which I guessed may be what the missing value was all about.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
bookmark, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sent emails end up in both Sent and Draft folders Begadoc Outlook 2 11-26-2013 02:42 PM
Can't finish message in Draft rdcrags Outlook 0 06-09-2013 09:16 PM
Huge cursor in draft mode DML Word 3 09-28-2012 05:06 PM
Draft Shortcut? Mr.Bumble Outlook 0 05-11-2012 11:09 AM
Getting out of Draft View Microsoftenquirer1000 Word 2 04-09-2012 11:52 AM

Other Forums: Access Forums

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