Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Sub NewQVWFile
set NewTest = ActiveDocument.GetApplication
NewTest.CreateDoc.SaveAs("C:\Users\admin\Desktop\NewApp's\first.qvw")
NewTest.CloseDoc //error generating here
End Sub
i tried above macro code for creating new QVW file and save and then close the first.qvw file.
the above macro is creating new qvw file and saving the file as first.qvw upto here it is working fine
but while coming closing the first.qvw file creating problem.
Please can anyone help in this ?
Thanks in advance.
see the attached file
only you need to do is change the path of this test application in macro
hope this helps
hi sunil, thanks for your reply.
i tried below macro its working fine.
Please can you cross check below macro and suggest me whether we are having any other better approach to acheive like this.
[Note : please check performance perspective also]
Sub NewQVWFile
set NewFile = ActiveDocument.GetApplication
NewFile.CreateDoc.SaveAs("C:\Users\admin\Desktop\NewApp's\first.qvw")
set app = NewFile.OpenDoc("C:\Users\admin\Desktop\NewApp's\first.qvw","","")
rem ** add new line to script **
set docprop = app.GetProperties
docprop.Script = docprop.Script & "LOAD * FROM [..\InputFields\RTQMain.qvd](qvd);"
app.SetProperties docprop
app.Reload
app.save
End Sub
Thanks in advance.
Sub NewQVWFile
set NewFile = ActiveDocument.GetApplication
NewFile.CreateDoc.SaveAs("C:\Users\admin\Desktop\NewApp's\first.qvw")
set app = NewFile.OpenDoc("C:\Users\admin\Desktop\NewApp's\first.qvw","","")
rem ** add new line to script **
set docprop = app.GetProperties
docprop.Script = docprop.Script & "LOAD * FROM [..\InputFields\RTQMain.qvd](qvd);"
app.SetProperties docprop
app.Reload
app.save
End Sub
i thing there is no need of line in bold
else its working.
Hi Sunil,
First time i am having only one application i.e; "CreateQVWFile.qvw"
In the above qvw file having a button action that contains action like to create new qvw file & save and reload the given qvd.
After clicking the button it create new qvw file "First.qvw".
So that why we are creating new QVW file.
Thanks in advance.
Hi sunil,
I tried below macro code for adding new script line into existed tab "Main 2" ,
but the below code works like creating another new tab "Main 2" and adding the script line as $(Include=d:\vqd eat\text\test.txt);
what to change in below code for add new script line into existed tab "Main 2" ?
docprop.Script = docprop.Script & chr(13) & chr(10) & "///$tab Main 2" & chr(13) & chr(10) & "$(Include=d:\vqd eat\text\test.txt);"
Thanks in advance