A voir également:
- Communication etre citect et excel
- Word et excel gratuit - Guide
- Liste déroulante excel - Guide
- Si et ou excel - Guide
- Déplacer colonne excel - Guide
- Excel trier par ordre croissant chiffre - Guide
3 réponses
Bonjour,
Pour lire/ecrire des valeurs entre citect et excel, il faut creer une communication DDE (Dynamic Data Exchange).Dans l'aide, il faut chercher à la fonction Cicode DDEhInitiate():
! Read from Excel spreadsheet
STRING FUNCTION GetExcelData();
INT hChannel;
STRING sData;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
sData = DDEhRequest(hChannel, "R1C1");
DDEhTerminate(hChannel);
hChannel = -1;
END;
RETURN sData;
END
! Write to Excel spreadsheet
FUNCTION SetExcelData(STRING sData);
INT hChannel;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
DDEhPoke(hChannel, "R1C1", sData);
DDEhTerminate(hChannel);
hChannel = -1;
END;
END
! Execute Excel Macro
FUNCTION DoExcelMacro();
INT hChannel;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
DDEhExecute(hChannel, "[RUN(^"TestMacro^")]");
DDEhTerminate(hChannel);
hChannel = -1;
END;
END
et voilou.....
Pour lire/ecrire des valeurs entre citect et excel, il faut creer une communication DDE (Dynamic Data Exchange).Dans l'aide, il faut chercher à la fonction Cicode DDEhInitiate():
! Read from Excel spreadsheet
STRING FUNCTION GetExcelData();
INT hChannel;
STRING sData;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
sData = DDEhRequest(hChannel, "R1C1");
DDEhTerminate(hChannel);
hChannel = -1;
END;
RETURN sData;
END
! Write to Excel spreadsheet
FUNCTION SetExcelData(STRING sData);
INT hChannel;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
DDEhPoke(hChannel, "R1C1", sData);
DDEhTerminate(hChannel);
hChannel = -1;
END;
END
! Execute Excel Macro
FUNCTION DoExcelMacro();
INT hChannel;
hChannel = DDEhInitiate("EXCEL", "DATA.XLS");
IF hChannel > -1 THEN
DDEhExecute(hChannel, "[RUN(^"TestMacro^")]");
DDEhTerminate(hChannel);
hChannel = -1;
END;
END
et voilou.....
merci bien pour ta repence
mais jj ai un petit probleme j ai fais la simulation de mon programme j ai creer un fichier excel et j ai declarer tout les variable necessaire et sur la editeur graphique j ai creer un nembre qui correspond a "hchannel" pour voir la validation de la communication et un n autre pour sdata mais jusqau a maintenant j ai rien ni au niveau du fichier excel ni au niveau de ma page graphique
est ce que j ai manqué quelque chose?
mais jj ai un petit probleme j ai fais la simulation de mon programme j ai creer un fichier excel et j ai declarer tout les variable necessaire et sur la editeur graphique j ai creer un nembre qui correspond a "hchannel" pour voir la validation de la communication et un n autre pour sdata mais jusqau a maintenant j ai rien ni au niveau du fichier excel ni au niveau de ma page graphique
est ce que j ai manqué quelque chose?
Bonjour,
le baroudeur, comment fait tu aprés au niveau de citect pour appeler le fichier cicode? Moi je voudrais créer un bouton et que lorsqu'on clique dessus, ça ouvre un fichier excel c'est tout, quelqu'un pourrait m'aider?
Merci d'avance
le baroudeur, comment fait tu aprés au niveau de citect pour appeler le fichier cicode? Moi je voudrais créer un bouton et que lorsqu'on clique dessus, ça ouvre un fichier excel c'est tout, quelqu'un pourrait m'aider?
Merci d'avance
Bonjour, enfaite pour etablir une communication en temps reel entre excel et vijeo citect vous aurez besoin d'un programme externe "vijeo historian" dont vous pouvez acqerir les courbes sous forme des tableaux excel . en outre vous pouvez egalement utiliser la fonction cicode "TrnExportDBF" pour exporter les courbes sous forme de fichier dbf que tu peux ouvrir sous excel