vkrisz81

Problem in excel udf

12 posts in this topic

#1 ·  Posted (edited)

Hello

so when i try attach an opened excel window, it fails!

when i try list out by using excel_booklist also cant find the opened window.. i cant find out HOW!!!

sometimes works, sometimes dont

and interesting, if once it find, next time it says error..

WOW

 

Edited by Melba23
Amended title

Share this post


Link to post
Share on other sites



so i open an existing xls by using excel_openbook, and other program cant find it by using booklist()

can anybody tell how it POSSIBLE?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

so i tried to get opened excel's title by using winlist, and user excel attach  with parameter "Title" and still nothing

so excel UDF in this way USELESS

in my opinion cant be usefull something what sometimes works, sometimes not in same way.. trustless

Edited by vkrisz81

Share this post


Link to post
Share on other sites

Instead of being an ass about it, post your code so we can test it ourselves.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

sure i post but not much code needed, only 2 rows the whole what you can find out also by the given datas but here you are

this bug is present here since a year almost.. so i am not suprised that this does not work properly..

my main program opens file

$excel=_Excel_Open()
_Excel_BookOpen($excel,@ScriptDir&"\_work.xls")

and client try reach this and handle cells in common excel file:

$a=_Excel_BookList()
_ArrayDisplay($a)
$excel=_Excel_BookAttach("_work.xls","filename")

a delivers NOTHING, as if already opened excel would not exist..

but there is

i tried open pre the excel and run the program after to link but nothing

and sometimes it finds instant

on other machine it works.. here  NOW not

but how can program can be good if it works if it wants not if it needed

 

Instead of being an ass about it, post your code so we can test it ourselves.

if it would work at you, that would not solve my problem that sometimes works NOT

unstable

 

i also tried use winlist to get excel's title and try attach by using title but also unsuccess!

$a=WinList("[REGEXPTITLE:(?i)(.*_work.*|.*Microsoft Excel.*)]")
    $excel=_Excel_BookAttach($a[1][0],"Title")

 

 

as i remember it works only first time, after it never till i restart whole computer..

so excel attach only find when you ask it first, never more

only if restart whole machine.. so ridicoulos :D

 

Edited by Melba23
Multiple posts merged

Share this post


Link to post
Share on other sites

vkrisz81,

Stop posting every 2 minutes to artificially boost your post count.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

You have to do two things:

  • Add error checking to your script. Every _Excel* function sets @error in case of a problem. Check and only keep on processing when @error = 0
  • You have to save the returned object so you can access it later. Else it will be dropped. means:
$oExcel=_Excel_Open()
If @error Then Exit MsgBox(0, "Error!", "_Excel_Open failed with error " & @error)
$oWorkBook = _Excel_BookOpen($oExcel, @ScriptDir & "\_work.xls")
If @error Then Exit MsgBox(0, "Error!", "_Excel_BookOpen failed with error " & @error)

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

vkrisz81,

Stop posting every 2 minutes to artificially boost your post count.

M23

 

 

Edited by vkrisz81

Share this post


Link to post
Share on other sites

You have to do two things:

  • Add error checking to your script. Every _Excel* function sets @error in case of a problem. Check and only keep on processing when @error = 0
  • You have to save the returned object so you can access it later. Else it will be dropped. means:
sometimes shows i have no acces to that excel file because other program use it..

sure other use because more program must use same excel to handle common datas

best way would be if i would be able shared memory addresses.. but i cant solve it, so i need this broken method to share data between programs

Share this post


Link to post
Share on other sites

Glad you removed your comments from Melba's and my posts. You would have been in big trouble if a Mod would have noticed them.

Now, as you have cooled down, lets see how to help you solve your problem:

sure other use because more program must use same excel to handle common datas

Excel can only have multiple people use the same Workbook when the access diferent worksheets. So this is quiete limited.

First question:
Do all users need write access to this workbook or would read access be fine as well?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

vkrisz81,

It seems you are lucky that I was on the golf course this morning. I will be watching you closely from now on.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now