VBA and Dataprovider

Hello

I am running a BO report from VB6 and need to open the data provider to include and run some data from a .csv file. Does any one you there know how to do that?
I also need to change the titleheader to include the filename of the .csv file and havent got a cluse how to do that. Anyone?

Thank you!

Kind Regards
Mikael :lol:


Yoda :american_samoa: (BOB member since 2004-06-29)

First, welcome to BOB. We hope you find it a useful resource.

Next, I’m not sure why VB is necessary to get data from a csv file. Create the data provider using the csv as a personal data provider, and a “normal” refresh (ThisDocument.Refresh in your code) will update the data.

If you’re wanting the csv filename to change each time (user prompted maybe), then it will be more difficult. The object model really offers very little support for anything other than universe-based data providers. The only thought that comes to mind is to use VB to change (or copy) the chosen filename to a hardcoded one that uses the previous suggestion (just refresh it).

As far as putting the csv filename in a cell, create a variable with the filename (say ), and display that variable in a cell. Then you can change the “formula” for the variable with VBA:

ThisDocument.DocumentVariables("CSVfilename").Formula = "chosenfile.csv"

Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Thank very much you for your reply.

I have put a lot of manual tasks into this VB program and the BO part is to produce some reports at the end of this line of tasks.

I am not completely sure what you mean. I have this report (.rep) file and I need to import the .csv file en run it. I can open BO and open the .rep file, but then I am stuck. What are the command for importing the .csv file into the existing report?

THANK YOU

Kind Regards
Mikael


Yoda :american_samoa: (BOB member since 2004-06-29)

CSV files are not “imported” into a report (manually or otherwise). As stated previously, you can create a personal data provider with a CSV file as the source. Then you simply refresh the data provider (this can be automated) and the report will reflect the new data.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)