Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
for sure it is easy. I have selected e.g. a customers data set. Now I want to extract e.g. customer's name into a Word File. I arrenged opening the word file with a specific form. Then I want to fill a bookmark in this form.
Challange for me is now to bring customer's name as a string.
Can somebody help ?
Thx and regards
Clemens
sub LeadMeldungIt
Set appWord = CreateObject("Word.Application")
Set myDoc = appWord.Documents.Add("C:\Users\cschmidt\Documents\mw_Lead.dotx")
Set Table = ActiveDocument.GetSheetObject("LB34")
Set Name1 = ActiveDocument.Fields("Auftraggeber").GetSelectedValues
qvlib.MsgBox(Name1.Text)
Textmarke1="Firmenname"
appWord.WindowState = 0
appWord.Height = 600
appWord.Width = 800
appWord.Left = 40
appWord.Top = 20
appWord.Visible = True
If myDoc.Bookmarks.Exists(Textmarke1) Then
Set rng = myDoc.Bookmarks(Textmarke1).Range
rng.Text = Name1
myDoc.Bookmarks.add Textmarke1, rng
End If
end Sub
If I understand your problem is to pass parameter from QV to Word right ?
What I did is to create a variable in Word (Insert Field then go into VariableDoc in the list and type the name of a parameter).
Then add the following code in the macro :
appWord.ActiveDocument.Variables("VariableName") = TheValue
I hope this will help you .
Rgds,
Sébastien
Hi Sebastian,
thx for answering. Sorry, if I described it in a wrong way. I just want to transfer a value from a certain object "LB34" field "Auftraggeber" into word. transfer is in data type text. If I change rng.text = Name1 into rng.Text 0 "Company" evrything is working fine.
regards Clemens