Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
In my file i am writing macro code for creating a new QVW File from existing QVW File. And i am giving the New QVW File Name as current date and time.
Pls check the below code, which is in BOLD line there i am facing error.
sub CreateNewQVW
Set vNP=ActiveDocument.Variables("vNewPath")
set lb=ActiveDocument.GetApplication.CreateDoc
set vp= "Test"&replace(Date(),"-","")&"_"&replace(Time(),":","") // Here i am getting an error i.e; Object required: '[string: "Test22072011_072816 "]'
lb.SaveAs vNP.GetContent.String &"\"& vp.GetContent.String&".qvw"
end sub
Can anyone help on this issue.
Thanks in advance
following line is also wrong, it should be something like
lb.SaveAs vNP.GetContent.String &"\"& vp &".qvw"
you don't need to use "set" there, set is only for objects not for variables.
vp= "Test"&replace(Date(),"-","")&"_"&replace(Time(),":","")
following line is also wrong, it should be something like
lb.SaveAs vNP.GetContent.String &"\"& vp &".qvw"
Hi
Remove the "set" on the error line. Set is for objects, which is what are creating in the first two lines. The third line is a string, which is not an object.
Hope that helps
Jonathan
Hi Daniel,
You make me free now , i am facing this problem from last two hours.
I had one more doubt , i.e; can we pass the QVS file for new QVW file from Existed QVW file using macro.
i.e; When i am creating new file itself then it should pass the script QVS file.
How i can update in below code.
Sub Test123
Set vNP=ActiveDocument.Variables("vNewPath")
set lb=ActiveDocument.GetApplication.CreateDoc
vp= "Test"&replace(Date(),"-","")&"_"&replace(Time(),":","")
lb.SaveAs vNP.GetContent.String &"\"& vp &".qvw"
End Sub
Thanks in Advance