Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am looking for Macro examples to accomplish the
below scenario
I have customer no from the excel or text file.
Customer.qvw file has customer relevant details.
We have to select the customerno from the external file(text or excel file) and pass the selected customerno to Customerno selection in the Customer.qvw (restrict only those selected customer in the Customer.qvw file).
Current selection - It suppose to show only selected customers from the file.
Advance thanks for your help.
Here's an example using an Excel file:
Sub Excel_OLE_Automation
Set oXL=CreateObject("Excel.Application")
f_name=oXL.GetOpenFilename("All Files (*.*),*.*",,"Select file",False)
If f_name="False" then
'user cancelled out of dialog box
Set oXL=nothing
Exit sub
End If
Set oWB=oXL.Workbooks.Open(f_name)
Set oSH=oWB.Worksheets.Item(1)
xlVal = oSH.Range("A2")
ActiveDocument.Variables("vXLCust").SetContent xlVal, true
ActiveDocument.Fields("Customerno").Select xlVal
oWB.Close
Set oSH=nothing
Set oWB=nothing
Set oXL=nothing
End Sub
I am getting the message
ActiveX component can't create object
Where do I need to set the file path for reading the file.(Select file)
It will be great - please provide me the qvw file.
Are you running this as a plug-in or native client? I am not sure the Excel DOM will work in the plug-in.
You may also need to allow system access. In your macro window, set Requested Module Security to System Access and Current Local Security to Allow System Access.
I don't really have a QVW that demonstrates this. I modified a macro I created in the past. That QVW is just the macro and a button along with an Excel file.