Excel에서 사용할 .net 개체가 있습니다. 이 개체를 호출하려면 변경할 필요가 기존 VBA 스크립트가 있습니다. 그런 다음 객체를 TLB로 변환했습니다. 나는이 분야에 대해 실제로 만진 적이 없기 때문에 도움을 얻을 수 있습니다.Excel VBA 양식에서 C# .net 개체 사용
내가 인터페이스
[Guid("0F700B48-E0CA-446b-B87E-555BCC317D74"),InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface IOfficeCOMInterface
{
[DispId(1)]
void ResetOrder();
[DispId(2)]
void SetDeliveryAddress(string PostalName, string AddressLine1, string AddressLine2, string AddressLine3, string AddressLine4, string PostCode, string CountryCode, string TelephoneNo, string FaxNo, string EmailAddress);
}
을 만든 또한 그 객체를 상속 클래스를 만들었습니다.
[ClassInterface(ClassInterfaceType.None), ProgId("NAMESPACE.OfficeCOMInterface"), Guid("9D9723F9-8CF1-4834-BE69-C3FEAAAAB530"), ComVisible(true)]
public class OfficeCOMInterface : IOfficeCOMInterface, IDisposable
{
public void ResetSOPOrder()
{
}
public void SetDeliveryAddress(string PostalName, string AddressLine1, string AddressLine2, string AddressLine3, string AddressLine4, string PostCode, string CountryCode, string TelephoneNo, string FaxNo, string EmailAddress)
{
try
{
SalesOrder.AmendDeliveryAddress(PostalName, AddressLine1, AddressLine2, AddressLine3, AddressLine4, PostCode);
MessageBox.Show("Delivery address set");
}
catch (Exception ex)
{
throw ex;
}
}
}
처분에서 벗어난 개체 방법에 액세스 할 수 없습니다. 내가해야 할 일이 있습니까?
질문을 잊어 버렸습니다. –
죄송합니다. 지금 추가했습니다. 미리 감사드립니다. –