![]() |
|
#1
|
|||
|
|||
|
Hi guys,
I'm having trouble with this vba code and I have no idea how to solve this. Sub ApplyDraft() With ActiveDocument If .Bookmarks.Exists("Status") Then WriteToBookmarkRange "Draft", cboYourName.Value End With Application.ScreenUpdating = True Unload Me End Sub The problem lies with the WriteToBookmarkRange Thank you!! |
|
#2
|
||||
|
||||
|
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
Code:
If .Bookmarks.Exists("Status") Then FillBM "Draft", Environ("USERNAME")
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
| 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 |