Range.ConvertToLinkedDataType method (Excel)

Attempts to convert all the cells in the range to a Linked data type such as Stocks or Geography.

Syntax

expression.ConvertToLinkedDataType (ServiceID, LanguageCulture)

expression A variable that represents a Range object.

Parameters

Name Required/Optional Data type Description
ServiceID Required Long The ID of the service that will provide the linked entity.
LanguageCulture Required String A string representing the LCID of the language and culture that you would like to use for the linked entity.

Remarks

The method will fail and throw a runtime exception 1004 if the specified locale is not supported on the specified service.

It will have no effect (and throw no exception) in these cases:

  • The cells in the range are blank (that is, there is nothing to convert).
  • The cells in the range contain a formula. If you want to convert such a range, you need to set the cell values to the current calc result first.
  • The cells in the range have already been converted to the specified data type.

Example

This code will convert cell E5 to a Stocks Linked data type in the US-English locale.

Range("E5").ConvertToLinkedDataType ServiceID:=268435456, LanguageCulture:= "en-US"

This code will convert cell E6 to a Geography Linked data type in the US-English locale.

Range("E6").ConvertToLinkedDataType ServiceID:=536870912, LanguageCulture:= "en-US"

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.