EBDN - Community - Question & Answers

  Wednesday, 22 February 2017
  1 Replies
  1.2K Visits
0
Votes
Undo
Hello Everyone
I am writing a VBA Code to add a New Device to EBASE Catalog. For which my VBA Code is working fine.

But the end of the VBA code when I try to add Preffered MasterShape using AddNew Method. I get an Run time Error '13' Type Mismatch
for the following lines of VBA Code. Where "oNewPref" is declared as MasterShape and "oNewDevice" is declared as ObjectItem

Dim oNewDevice As ObjectItem
Dim oNewPref As MasterShape

Set oNewDevice = Whatever New Device add to EBASE Catalog
Set oNewPref = Whatever MasterShape I find from the Stencils

With oNewDevice.PreferredMasters
..AddNew (oNewPref) <<<<<<----Getting Run time Error '13' Type Mismatch
End With

Instead of Using Set oNewDevice = Whatever New Device add to EBASE Catalog

If I use Set oNewDevice = Application.Selection(1) and change above VBA code as per following. I DO NOT get error at ",AddNew (oNewPref)

Set oNewDevice = Application.Selection(1)
Set oNewPref = Whatever MasterShape I find from the Stencils

With oNewDevice.PreferredMasters
..AddNew (oNewPref) <<<<<<----I DO NOT get Run time Error '13' Type Mismatch and Preffered MasterShape as added Device Selected under the Catalog
End With

I will appreciate your support. My email is This email address is being protected from spambots. You need JavaScript enabled to view it.