M
Mike
I've been reading several usegroups for hours now and couldn't find a
solution that works.
I have a document with bookmark field called "Document_title".
I want this field to be words suggestion for the filename when the
file first gets saved as.
I also have a little more code to update other bookmarks in the
document on save and save as:
The following part updates the fields / bookmarks on a save:
Sub filesave()
Dim oStory As Range
ActiveDocument.save
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub
This part is supposed to update the fields / bookmarks of the document
and suggest the "Document_title" content as the save as filename:
Sub filesaveas()
Dim oStory As Range
Dialogs(wdDialogFileSaveAs).Show
ActiveWindow.Caption = ActiveDocument.FullName
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
Dim FileName As String
FileName = ActiveDocument.Bookmarks("Document_title")
With Application.Dialogs(wdDialogFileSaveAs)
.Name = FileName
.Show
End With
End Sub
All of this is in the "This document" Word objects.
I tried several other things, all pretty similar to this one.
I'm using word 2003.
Can someone help?
solution that works.
I have a document with bookmark field called "Document_title".
I want this field to be words suggestion for the filename when the
file first gets saved as.
I also have a little more code to update other bookmarks in the
document on save and save as:
The following part updates the fields / bookmarks on a save:
Sub filesave()
Dim oStory As Range
ActiveDocument.save
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub
This part is supposed to update the fields / bookmarks of the document
and suggest the "Document_title" content as the save as filename:
Sub filesaveas()
Dim oStory As Range
Dialogs(wdDialogFileSaveAs).Show
ActiveWindow.Caption = ActiveDocument.FullName
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
Dim FileName As String
FileName = ActiveDocument.Bookmarks("Document_title")
With Application.Dialogs(wdDialogFileSaveAs)
.Name = FileName
.Show
End With
End Sub
All of this is in the "This document" Word objects.
I tried several other things, all pretty similar to this one.
I'm using word 2003.
Can someone help?