Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2014, 07:56 AM
Dimsok Dimsok is offline Start from the previous position Windows XP Start from the previous position Office 2007
Advanced Beginner
Start from the previous position
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default Start from the previous position


Is that possible realise with vba? When i start ms word i need to open doc with previous position of cursos. Maybe something like autocreat bukmark when exit and autogo to it from the start?
Reply With Quote
  #2  
Old 09-13-2014, 03:27 PM
macropod's Avatar
macropod macropod is offline Start from the previous position Windows 7 64bit Start from the previous position Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Pressing Shift-F5 when you open a document will take you to the last edit. You don't need vba for this.

IIRC, Office 2007 didn't originally support that, but it was fixed with a service pack. If not, see: http://www.vbaexpress.com/forum/cont...you-re-open-it
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-13-2014, 09:10 PM
Dimsok Dimsok is offline Start from the previous position Windows XP Start from the previous position Office 2007
Advanced Beginner
Start from the previous position
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

Just when edited, but doesn't remember the last page when just viewing document?
Reply With Quote
  #4  
Old 09-13-2014, 09:58 PM
macropod's Avatar
macropod macropod is offline Start from the previous position Windows 7 64bit Start from the previous position Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

The link in my previous reply refers to a macro that can restore the functionality for Word 2007.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 09-13-2014, 11:14 PM
Dimsok Dimsok is offline Start from the previous position Windows XP Start from the previous position Office 2007
Advanced Beginner
Start from the previous position
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

the template is right? It still doesn't work for me. No hidden bookmark created
Attached Files
File Type: zip Normal.zip (47.9 KB, 12 views)
Reply With Quote
  #6  
Old 09-13-2014, 11:43 PM
macropod's Avatar
macropod macropod is offline Start from the previous position Windows 7 64bit Start from the previous position Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

The bookmark is created in the document being edited, not in the template. But none of that is going to happen if you don't follow the instructions in the link. Your attachment shows quite clearly you haven't done that.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 09-14-2014, 03:35 AM
Dimsok Dimsok is offline Start from the previous position Windows XP Start from the previous position Office 2007
Advanced Beginner
Start from the previous position
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

Code:
Option Explicit
 Sub FileSave()
 On Error Resume Next
 ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="OpenAt"
 ActiveDocument.Save
 InsertDocTitle
 End Sub

 Sub FileSaveAs()
 On Error Resume Next
 ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="OpenAt"
 Dialogs(wdDialogFileSaveAs).Show
 InsertDocTitle
 End Sub

 Sub AutoOpen()
 On Error Resume Next
     With ActiveWindow.View
         If Err.Number = 4248 Then Exit Sub
         .Type = wdPrintView
         .Zoom = 100
         .TableGridlines = True
     End With
     ActiveWindow.ActivePane.View.ShowAll = False
     ActiveWindow.ActivePane.View.ShowFieldCodes = False
     If ActiveDocument.Bookmarks.Exists("OpenAt") = True Then
         ActiveDocument.Bookmarks("OpenAt").Select
     End If
     InsertDocTitle
 End Sub

 Sub InsertDocTitle()
 ' Changes window title to include path with filename
     Dim NameArray As Variant
     Dim NameStringL As String
     Dim NameStringR As String
     Dim Count As Long
     Const maxLen = 120   ' set this value to fit your window width
     ' (avoid error if no active window)
     If Windows.Count > 0 Then
         NameStringL = ActiveDocument.FullName
         If Len(NameStringL) > maxLen Then
             ' separate the folder names
             NameArray = Split(NameStringL, "\")
             ' check the folder depth
             Count = UBound(NameArray)
             If Count > 3 Then
                 NameStringL = NameArray(0) & "\...\"
                 NameStringR = NameArray(Count)
                 Count = Count - 1

                 ' continue adding folders to the left of the string
                 ' until you run out of folders or one won't fit
                 Do While (Count > 0) And _
                    (Len(NameStringL) + Len(NameStringR) + _
                     Len(NameArray(Count)) < maxLen)
                     NameStringR = NameArray(Count) & "\" _
                                 & NameStringR
                     Count = Count - 1
                 Loop

                 NameStringL = NameStringL & NameStringR
             End If
         End If

         ' Change the window's caption
         ActiveWindow.Caption = NameStringL
     End If
 End Sub
Can you please change the code that "OpenAt" bookmark was hidden and the 5th to delete that bookmark?
Reply With Quote
  #8  
Old 09-14-2014, 06:07 AM
macropod's Avatar
macropod macropod is offline Start from the previous position Windows 7 64bit Start from the previous position Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

There is nothing wrong with the code in the link. It is your implementation that is the problem, solely because you haven't followed the instructions.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Start from the previous position Header - same as previous dianabanana Word 5 04-28-2014 06:03 AM
Start from the previous position reference previous heading1 fehenry Word 5 04-20-2012 01:54 AM
Start from the previous position VBA: how can I know the position on a document? tinfanide Excel Programming 3 02-27-2012 03:24 PM
fix position for a segment in a doc tai Word 3 10-20-2011 01:04 PM
Previous Doc pops up Les Harris Word 1 01-19-2009 04:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:26 AM.


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