LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determine a excel file exists or not by active x

I w a n t t o a d d t h e d i f f e r e n t d a t a a b o u t a s p e c i f i e d U U T t o d i f f e r n t w o r k s h e e t o f a s p e c i f i e d w o r k b o o k s . I f t h i s w o r k b o o k d o e s ' t e x i s t , t h e n c r e a t i t a n d s t o r e t h e d a t a . I f t h i s w o r k b o o k a l r e a d y e x i s t , t h e n o p e n i t a n d s t o r e t h e d a t e i n a n e w w o r k s h e e t . B u t h o w c a n t h e p r o g r a m k n o w w h e t h e r t h e e x c e l 9 7 f i l e e x i s t a u t o m a t i c a l l y ? T h e q u e s t i o n a b o v e i s b a s e d o n l a b
v i e w 5 . 1 a c t i v e x a n d e x c e l 9 7 .
0 Kudos
Message 1 of 2
(2,688 Views)
Use Workbooks.Open(...) method which takes the XLS file path
to open. It returns a reference to the Workbook object if succeeded.
Otherwise this action raises a COM exception. Sorry but I don't
know how to handle COM exceptions in a general way. (I think
the Error Out control may report an error if failed.)

Makoto


"east" wrote in message
news:50650000000800000009160000-983677784000@quiq.com...
> I w a n t t o a d d t h e d i f f e r e n t d a t a a b
> o u t a s p e c i f i e d U U T t o d i f f e r n t w
> o r k s h e e t o f a s p e c i f i e d w o r k b o o k s . I
> f t h i s w o r k b o o k d o e s ' t e x i s t , t h e n c
> r e a t i t a n d s t o r e t h e d a t a . I f t h i s
> w o r k
b o o k a l r e a d y e x i s t , t h e n o p e n i t
> a n d s t o r e t h e d a t e i n a n e w w o r k s h e
> e t . B u t h o w c a n t h e p r o g r a m k n o w w h e
> t h e r t h e e x c e l 9 7 f i l e e x i s t a u t o m a t
> i c a l l y ? T h e q u e s t i o n a b o v e i s b a s e d
> o n l a b v i e w 5 . 1 a c t i v e x a n d e x c e l 9 7
0 Kudos
Message 2 of 2
(2,688 Views)