Jump to content

Opening Excel File with external links ... ?


Recommended Posts

Hi,

i would like to open an Excel file containing external links. In this case u got a popup window asking if u want to update or not the links contained.

Is there any way to open this file with autoit by providing an automatic or default answer to the "update links" question ?

Thanks !

Link to comment
Share on other sites

Hi,

i would like to open an Excel file containing external links. In this case u got a popup window asking if u want to update or not the links contained.

Is there any way to open this file with autoit by providing an automatic or default answer to the "update links" question ?

Thanks !

Use the Autoit Info tool to find out the name of that window/class of that window and the control for the 'yes' (if there is one) button. And then just use controlclick or controlsend (depending on what you need) to actually click the button for you.

That would be my guess :)

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Use the Autoit Info tool to find out the name of that window/class of that window and the control for the 'yes' (if there is one) button. And then just use controlclick or controlsend (depending on what you need) to actually click the button for you.

That would be my guess :)

Yeah but how ? in two different processes ? one opening the file and a second checking the popup window ? ... doesn't look very reliable ...

thanks for helping anyway.

Link to comment
Share on other sites

Yeah but how ? in two different processes ? one opening the file and a second checking the popup window ? ... doesn't look very reliable ...

thanks for helping anyway.

No.

Lookup these functions in the Help File:

1. ShellExecute

2. WinActive, WinExists, WinWait, WinWaitClose, WinWaitNotActive,

3. ControlSend

4. ControlClick

One autoit script can launch excel; wait until the program is active, wait until a specified window is active, and then send a click to that control's 'yes' button. Personally, I don't use Excel, so I can't test this out for you :)

I'm an OpenOffice guy :D But, you don't need 2 separate processes :(

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Did some googling check this out... Click me

Seems like you maybe able to trap the error with $oExcel.Application.EnableEvents = False ... can't test it though. Also you may have more luck posting in the excel UDF topic in the example forum. Only if you can't get anywhere here that is.

Let us know how that works out

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

i have just written a "test-popup.exe" ... ran by my main script just before opening the Excel File ... test-popup.exe contains a WinWaitActive waitin for the "update link" popup and sendin an automatic Yes or No to the question ...

I don't find the solution very clean ... but it works so far ...

Link to comment
Share on other sites

i don't understand ... when i sometimes try to open this Excel File with $oExcel = _ExcelBookOpen("C:\example.xls") i have a popup "update link" window and sometimes when tried on an other computer ... it doesnt popup ... weird ...

I haven't tried adlib so far ...

Link to comment
Share on other sites

how can the direct opening of an excel file in the file manager generate this "update links" popup ... which doesn't appear when opened by my autoit script (which is good but not understandable for me ... and doesnt always behave this way ...)

do u know ?

Link to comment
Share on other sites

Well...I wish I had started off at msdn, as the answer was a simple as adding a 0.

I didn't try incorporating this into the Excel UDF, but I'm sure you can if you feel like editing it.

$sFilePath = @DesktopDir & "\test.xls"
$oExcel = ObjCreate("Excel.Application")
With $oExcel
    .Visible = 1
    .WorkBooks.Open($sFilePath, 0)
EndWith

Look at the msdn link to learn more about it.

EDIT: a little unclear...

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

well :) ... RTFM is always a good advice ... ;-)

My mistake was that i used the excelcom UDF _ExcelBookOpen command that (i think) doesn't contain this parameter.

But when tryin the basic COM workbook OPEN command it works as expected ...

Thanks for ur help !

Link to comment
Share on other sites

  • 1 year later...

$sFilePath = @DesktopDir & "\test.xls"

$oExcel = ObjCreate("Excel.Application")

With $oExcel

.Visible = 1

.WorkBooks.Open($sFilePath, 0)

EndWith

This opens the file as read only. If you want to update the links it won't work. You can set the excel file to open and automatically update links under Edit>Links from the toolbar.

Link to comment
Share on other sites

You are not right - The open method have it all :

Parameters:

UpdateLinks Optional

Variant Specifies the way links in the file are updated. If this argument is omitted, the user is prompted to specify how links will be updated. For more information on the values used by this parameter, see the Remarks section. If Microsoft Excel is opening a file in the WKS, WK1, or WK3 format and the UpdateLinks argument is 2, Microsoft Excel generates charts from the graphs attached to the file. If the argument is 0, no charts are created.

ReadOnly Optional

Variant True to open the workbook in read-only mode.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...