![]() |
|
#5
|
|||
|
|||
|
Quote:
I really don't know how else to say it or maybe people who reading this are looking into this post too deeply and I'm not the brightess when it comes to VBA please help ..Heres what I have so far Code:
Private Sub Document_Open()
Dim path, pwd As String
Dim mybookmark As String
Dim BMRange As Range
pwd = gint3232
mybookmark = System.PrivateProfileString("P:\Industries\Workshops\Maintenance\settings.txt", _
"macrosettings", "mybookmark")
If mybookmark = "" Then
mybookmark = 1
Else
mybookmark = mybookmark + 1
End If
'Identify current Bookmark range and insert text
System.PrivateProfileString("P:\Industries\Workshops\Maintenance\settings.txt", "MacroSettings", _
"mybookmark") = mybookmark 'this line increments settings.txt by one
Set BMRange = ActiveDocument.Bookmarks("MyBookmark").Range
BMRange.Text = Format(mybookmark, "700000#") 'this line adds the numbers to the bookmark in word
path = "P:\Industries\Workshops\Maintenance\" 'this line is for saving when i eventually switch it on
ActiveDocument.Bookmarks.Add "MyBookmark", BMRange
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=password1
End If
ActiveDocument.SaveAs2
End Sub
Last edited by macropod; 07-25-2014 at 10:03 PM. Reason: Added code tags & formatting |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Need Help with Below Code
|
rsrasc | Word VBA | 6 | 04-01-2014 03:42 PM |
Where does my code go?
|
rbaldwin | Word VBA | 3 | 03-14-2012 02:31 PM |
vbc code
|
rajpeter | Excel Programming | 2 | 09-13-2011 02:29 PM |
| vba code in excel | rajpeter | Excel Programming | 5 | 09-11-2011 06:13 PM |