Hot News:

Mit Unterstützung durch:

  Foren auf CAD.de (alle Foren)
  CATIA V5 Programmierung
  CATIA vs EXCEL PROBLEM

Antwort erstellen  Neues Thema erstellen
CAD.de Login | Logout | Profil | Profil bearbeiten | Registrieren | Voreinstellungen | Hilfe | Suchen

Anzeige:

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen nächster neuer Beitrag | nächster älterer Beitrag
Autor Thema:  CATIA vs EXCEL PROBLEM (2924 mal gelesen)
toyo83
Mitglied
CAD Application Engineer


Sehen Sie sich das Profil von toyo83 an!   Senden Sie eine Private Message an toyo83  Schreiben Sie einen Gästebucheintrag für toyo83

Beiträge: 21
Registriert: 15.02.2007

Ok it works !!
You forgot to put File in brackets :)
Thanks and best REGARDS guys !!!!!!

erstellt am: 30. Mai. 2007 11:31    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities

HY
I Have a little problem with using excel object with Catia
I think this could be a vba problem. It looks like this:
I open a workbook with vba, then take some data from the workbook and use the data later in catia. But when im trying to use some excel object function like countA or range the vba editor prompts me with this error:

Method 'Range' of object '_Global' faild

This happends only with the first start of the makro, after the first start every thing with it is ok.
And the second thing is how can i trow the excel objcet out of memory, it always stays one in the system
This is the code form my sub
Public Sub mit()
'On Error Resume Next
Dim path As String
'Dim mith(), ohneh() As String
Dim ilew As Integer
Dim i As Integer
Dim area As Range
Dim mith() As String
'Static ohneh() As String
Dim objExcel As excel.Application
Dim objWorkbook As Workbook

path = "Z:\data\INTERNES\zk_zeichnungen\LC"

Set objExcel = CreateObject("Excel.Application"): objExcel.Visible = False
objExcel.SheetsInNewWorkbook = 1
Set objWorkbook = objExcel.Workbooks.Open(Filename:=path & "\materials.xls")

ilew = objExcel.WorksheetFunction.CountA(Range("A:A"))
ReDim mith(ilew - 2)

  For i = 1 To (ilew - 1)
  Set area = objWorkbook.Sheets(1).Range("A1").Offset((ilew - ilew) + i)
  mith(i - 1) = area.Value
  Next i

   


'objExcel.Visible = True 'pokazujemy okno Excela
'objWorkbook.save
'zwolnienei pami?ci zaj?tej przez zmienne obiektowe

mater.List = mith()

objWorkbook.Close
Set objExcel = Nothing
Set objWorkbook = Nothing

End Sub

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

qli
Mitglied



Sehen Sie sich das Profil von qli an!   Senden Sie eine Private Message an qli  Schreiben Sie einen Gästebucheintrag für qli

Beiträge: 13
Registriert: 16.04.2007

erstellt am: 30. Mai. 2007 13:56    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities Nur für toyo83 10 Unities + Antwort hilfreich

hi Toyo,

I don't really know why does your macro work except the first time, but did u checked all excel libraries from VBA - Tools - References within CATIA VBA?
wait... hmm... I see that U also make your excel not visisble. Do u close it from Processes window afterwards, before running your macro for the second time? if not, this could be the difference between the first and the second, third ... time running the macro.
That's all I can figure out right now.

qli

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Anzeige.:

Anzeige: (Infos zum Werbeplatz >>)

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen

nächster neuerer Beitrag | nächster älterer Beitrag
Antwort erstellen


Diesen Beitrag mit Lesezeichen versehen ... | Nach anderen Beiträgen suchen | CAD.de-Newsletter

Administrative Optionen: Beitrag schliessen | Archivieren/Bewegen | Beitrag melden!

Fragen und Anregungen: Kritik-Forum | Neues aus der Community: Community-Forum

(c)2023 CAD.de | Impressum | Datenschutz