V
VexedFist
I am trying to pass a Variable between Macros (Main and Analog) in MS-Word.
The user enters a Number in the message box. This is used to open multiple
Files that start with this number.
The Complete filename are: 123456_Analog65.txt and 123456_Digtial65.txt
etc...
This is only a small part of a large macro I want to use on multiple files
Example Macro:
Sub Main()
Dim Message, Title, Default
Dim Cmr As String
Message = "Enter New File Name:" ' Set prompt.
Title = "File Will be saved with this Name" ' Set title.
Default = " " ' Set default.
Cmr = InputBox(Message, Title, Default)
Application.Run MacroName:="Analog"
Application.Run MacroName:="Digital"
end sub
Sub Analog()
Dim MyRawData As String
Dim MyReconfiguredData As String
Underscore = "_"
Rawdir = "C:\"
Rawdata = "Analog65.txt"
MyRawData = Rawdir + Cmr + Underscore + Rawdata
MyReconfiguredData = "Analog65.txt"
ChangeFileOpenDirectory "C:\"
Documents.Open FileName:=MyRawData, ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
Selection.Find.ClearFormatting
With Selection.Find
.Text = "H500: AMO SCSU STARTED"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
end sub
Any assistance will be greatly appreciated
The user enters a Number in the message box. This is used to open multiple
Files that start with this number.
The Complete filename are: 123456_Analog65.txt and 123456_Digtial65.txt
etc...
This is only a small part of a large macro I want to use on multiple files
Example Macro:
Sub Main()
Dim Message, Title, Default
Dim Cmr As String
Message = "Enter New File Name:" ' Set prompt.
Title = "File Will be saved with this Name" ' Set title.
Default = " " ' Set default.
Cmr = InputBox(Message, Title, Default)
Application.Run MacroName:="Analog"
Application.Run MacroName:="Digital"
end sub
Sub Analog()
Dim MyRawData As String
Dim MyReconfiguredData As String
Underscore = "_"
Rawdir = "C:\"
Rawdata = "Analog65.txt"
MyRawData = Rawdir + Cmr + Underscore + Rawdata
MyReconfiguredData = "Analog65.txt"
ChangeFileOpenDirectory "C:\"
Documents.Open FileName:=MyRawData, ConfirmConversions:=False, ReadOnly _
:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate _
:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="" _
, Format:=wdOpenFormatAuto
Selection.Find.ClearFormatting
With Selection.Find
.Text = "H500: AMO SCSU STARTED"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
end sub
Any assistance will be greatly appreciated