Changing a column name through VBA script

Hi,

Would anyone have, and mind sharing, a bit of VBA code to change column names on a data block.

Presently, I am using something like:

ActiveDocument.DataProviders.Item(1).Columns.Item(1).Name = “newname”

However, when I run my macro I get the VBA error:

Run-time error ‘61837’: Unable to write read-only property.

If this property is truly read-only, how is it that I am able to change it manually in the data block (by double-clicking on the column header and simply typing)?

Am I referencing the wrong property in my VBA code?

Thank you,
Guy Johnson


Listserv Archives (BOB member since 2002-06-25)

Hi Guy,

Long time … no see. how r u?

You cannot change the Column name in the data provider. In data block you are able to change the column header, because it is a report not the data provider.

Regards
Vasan
Baton Rouge International Inc
Data warehousing Division

Guy_Johnson@NOTES.NTRS.COM on 03/22/2000 06:02:37 PM

Hi,

Would anyone have, and mind sharing, a bit of VBA code to change column names on
a data block.

Presently, I am using something like:

ActiveDocument.DataProviders.Item(1).Columns.Item(1).Name = “newname”

However, when I run my macro I get the VBA error:

Run-time error ‘61837’: Unable to write read-only property.

If this property is truly read-only, how is it that I am able to change it manually in the data block (by double-clicking on the column header and simply typing)?

Am I referencing the wrong property in my VBA code?

Thank you,
Guy Johnson

******************************************************************************* Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Ernst & Young LLP



Listserv Archives (BOB member since 2002-06-25)

Guy,

If you are changing the column header of a block in a report, a table block for instance, it is very different from what you are trying to do in your VBA.

Your code tries to change the name of a variable returned by a DP. This is the equivalent of going to the Data Manager, clicking on a variable (an object) and changing the name on the “Definition” tab. For queries, it is not allowed (grayed out), but possible for a personal data files type of DP. The object model shows the property is read-only anyway.

If I understand your objective, you must instead change the contents of the header cell in your block. Hope someone can help with the code, I’m not to sure how to do it.


Listserv Archives (BOB member since 2002-06-25)

But I don’t it is possible to access Data providers other than the ones based on universe thru’ SDK.

jfcayron@INFOSOL-INC.COM on 03/22/2000 06:30:32 PM

Guy,

If you are changing the column header of a block in a report, a table block for instance, it is very different from what you are trying to do in your VBA.

Your code tries to change the name of a variable returned by a DP. This is the equivalent of going to the Data Manager, clicking on a variable (an object) and changing the name on the “Definition” tab. For queries, it is not allowed (grayed out), but possible for a personal data files type of DP. The object model shows the property is read-only anyway.

If I understand your objective, you must instead change the contents of the header cell in your block. Hope someone can help with the code, I’m not to sure how to do it.


Listserv Archives (BOB member since 2002-06-25)

Hi Guys,

Right now I’m having a problem like this one, but I used the following script to export a B.O report to a Dbase IV database:

Set dp = ActiveDocument.DataProviders.Item(1) Call dp.ConvertTo(ExpDbase,0)

Then, with the resulting .dbf file I created a new B.O universe with this table, but in the objects I see the names like “COLBO_33, COLBO_34, and so on”, and I want to have the same column names like the original report.

Any help would be very appreciated.

B.O Version 4.1.4

Juan Hernandez
Plantronics Inc.
Tijuana, B.C Mexico.
email: juan.hernandez@plantronics.com


Listserv Archives (BOB member since 2002-06-25)