I'm trying to open a set of documents via macro (vbscript) in a button, using a user selected value in a field as document path and name, but keeps giving me "Failed to open document", if I replace de variable for fixed text it works
QV 10.0.9061.7 SR3 64bit
Windows 2008 R2 server standar 64 bit
sub Macro1 set doc1 = ActiveDocument set SelectedValueInDocument = doc1.fields("xDocuments").GetSelectedValues 'Note: the button is active only if GetSelectedCount('xDocuments')=1 if SelectedValueInDocument.Count > 1 then msgbox "Warning: there is more than 1 value selected" end if vDoc = SelectedValueInDocument.Item(0).text msgbox vDoc 'here shows correct path and document name (the name has no spaces, backslash, comma, colon or semi colon) set App = doc1.GetApplication set newdoc = App.OpenDoc (vDoc,"","") '' <<== this gives error 'set newdoc = App.OpenDoc ("C:\QV\DESA\APPS\common\QVW\MyChileDocument[6-2].qvw","","") '<- this works but need to change document to match user selection newdoc.Activate end sub '
Any Ideas why get error with the variable?