R
Rose
Hi,
I discovered VBA Find Replace and would like to alter it to call a specific
datafile and not the default ReplaceTextFiel.Doc file - I need some help -
very new at this and it is a little over my head. I have some code I put
together below but not sure where to put it. Would like to add 2 more option
buttons (which I can do) and put the code behind optionbuttons - I just need
lots of helpful guidance please to modify (at my own peril) - just love the
field replace that is very cool. But for a lot of my work I need the
different datafiles as the replacetxt files. Drowning VBA beginner:-
.. Option Button 3 Ask user for file number input variable: 071234?
.. Option Button 4 Ask user to make changes to existng data file?
.. So call: c:\DATA\071234.doc as the REPLACETXTFILE.doc
How do I incorporate the variables into the current code?
Dim vFileNo AS STRING
GetFileNo:
vFileNo = InputBox("Enter file number:", "FILE NUMBER")
If vFileNo = "" Then
USE BELOW;
Dim myName As String
Dim myPath As String
Dim docName As String
docName = InputBox("Please enter the file number:", "File Number")
myPath = ActiveDocument.Path
If myPath = "" Then
myPath = Options.DefaultFilePath(wdDocumentsPath)
End If
myName = myPath & Application.PathSeparator & "\DATA\" & docName
ActiveDocument.SaveAs myName
[[Use: c:\data\071234.doc ]]]
Replacement TEXT = myName.doc
End Sub
What is best way to achieve this and where do I put the code and how do I
code it:
Stuck as only I know how - many tks for any help guys....
Rosie
I discovered VBA Find Replace and would like to alter it to call a specific
datafile and not the default ReplaceTextFiel.Doc file - I need some help -
very new at this and it is a little over my head. I have some code I put
together below but not sure where to put it. Would like to add 2 more option
buttons (which I can do) and put the code behind optionbuttons - I just need
lots of helpful guidance please to modify (at my own peril) - just love the
field replace that is very cool. But for a lot of my work I need the
different datafiles as the replacetxt files. Drowning VBA beginner:-
.. Option Button 3 Ask user for file number input variable: 071234?
.. Option Button 4 Ask user to make changes to existng data file?
.. So call: c:\DATA\071234.doc as the REPLACETXTFILE.doc
How do I incorporate the variables into the current code?
Dim vFileNo AS STRING
GetFileNo:
vFileNo = InputBox("Enter file number:", "FILE NUMBER")
If vFileNo = "" Then
USE BELOW;
Dim myName As String
Dim myPath As String
Dim docName As String
docName = InputBox("Please enter the file number:", "File Number")
myPath = ActiveDocument.Path
If myPath = "" Then
myPath = Options.DefaultFilePath(wdDocumentsPath)
End If
myName = myPath & Application.PathSeparator & "\DATA\" & docName
ActiveDocument.SaveAs myName
[[Use: c:\data\071234.doc ]]]
Replacement TEXT = myName.doc
End Sub
What is best way to achieve this and where do I put the code and how do I
code it:
Stuck as only I know how - many tks for any help guys....
Rosie