I need a little help figuring out how I can get a certain data range using an input box command. Here is the code I have so far
When I run the program now I can input a phrase, but nothing is returned. I would like to be able to input Safety Switch(SS) or Transformer(XFMR) into the body of the input box and have the returned range copied and pasted onto the new word file. Can this be accomplished? Thank You in advance
Code:
Function Getdatarange()
Getdatarange = InputBox("Enter type of data for export")
Dim SS As Range
Dim XFMR As Range
Dim CT As Range
Dim LC As Range
Dim wordApp As Object
Dim fNameAndPath As String
Set SS = Worksheets("Sheet3").Range("A1:S16")
Set XFMR = Worksheets("Sheet3").Range("B25:H36")
Set CT = Worksheets("Sheet3").Range("M21:R24")
Set LC = Worksheets("Sheet3").Range("M31:R34")
fNameAndPath = "C:\Documents and Settings\Gerard\My Documents\BOM.doc"
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (fNameAndPath)
wordApp.Visible = True
End Function
When I run the program now I can input a phrase, but nothing is returned. I would like to be able to input Safety Switch(SS) or Transformer(XFMR) into the body of the input box and have the returned range copied and pasted onto the new word file. Can this be accomplished? Thank You in advance