Help

B

Ben

Hi,
Can it be done in the VB that
I have a document that actually make use of one word in
the document such as "S1234" to save as "S1234.doc" where
the "Sxxxx" in which the number may varies?
please assist.

regards,
Ben
 
J

Jezebel

Yes, provided your code can work out where in the document to find the
S1234: eg, if it's in a Bookmark location.

Alternatively, have some code to prompt the user for the number, then both
insert the value into the document and use it as a file name.
 
B

Ben

Hi,
how can it be done?
regards,
ben
-----Original Message-----
Yes, provided your code can work out where in the document to find the
S1234: eg, if it's in a Bookmark location.

Alternatively, have some code to prompt the user for the number, then both
insert the value into the document and use it as a file name.








.
 
J

Jezebel

Assign a bookmark to the area of the document that will contain the number.
In your code, use something like

pFileName = "S" & ActiveDocument.Bookmarks(CodeNumber).Range & ".doc"
 
W

Word Heretic

G'day "Ben" <[email protected]>,

Rather than randomized, what you need is a unique number. Nor I get
around this by using this routine:

Private Function MakeUniqueBookmark(ByVal BMStem As String) As String
Do
UniqueId = UniqueId + 1
MakeUniqueBookmark = BMStem & Format$(UniqueId)
Loop Until Not Source.Bookmarks.Exists(MakeUniqueBookmark)
End Function

Source in this case is an externally defined document and UniqueId an
external static.

You call this function and returns a unique name for you to create,
based upon the given stem.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Ben reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top