Followers 0

## 13 posts in this topic

Thanks

##### Share on other sites

Try this...

```#include <ExcelCOM_UDF.au3>

\$sFilePath = @ScriptDir & "\test.xls"
\$oWorkbook = _ExcelBookOpen(\$sFilePath)
\$oSheet = \$oWorkbook.ActiveSheet

ConsoleWrite("There are no hyperlinks in this worksheet." & @CR)
Exit
EndIf

\$sInfo = ""
\$sInfo &= "ScreenTip : " & .ScreenTip
\$sInfo &= "TextToDisplay: " & .TextToDisplay
EndWith
\$sInfo &= @CR & @CR
Next

ConsoleWrite(\$sInfo)```

##### Share on other sites

Thank you big_daddy, that did work, and I thought I was home free.

However I need to adapt it to work on a specific cell address. I went thru the msdn docs for excel, but I'm just going in circles.

So . . . if you know how to retrieve the Hyperlink for just one cell . . .

Thanks

##### Share on other sites

So . . . if you know how to retrieve the Hyperlink for just one cell . . .

Try this...

```#include <ExcelCOM_UDF.au3>

\$sFilePath = @ScriptDir & "\test.xls"
\$oWorkbook = _ExcelBookOpen(\$sFilePath)
\$oSheet = \$oWorkbook.ActiveSheet

; Return a range of cells
;~ \$oRange = \$oSheet.Range("A1:D5")

; Return a single cell (A6)
\$oRange = \$oSheet.Cells(6, 1)

ConsoleWrite("There are no hyperlinks in this worksheet." & @CR)
Exit
EndIf

\$sInfo = ""
\$sInfo &= "ScreenTip : " & .ScreenTip
\$sInfo &= "TextToDisplay: " & .TextToDisplay
EndWith
\$sInfo &= @CR & @CR
Next

ConsoleWrite(\$sInfo)```

##### Share on other sites

High Five! Thank you, that works perfect.

I'm trying to understand what you did, and it all makes sense except for the line:

What is \$oHyperlink? It isn't predefined. This use is slightly different than the example in the AutoIt help file. Is the use of the For . . . In . . . With the only way to extract the hyperlink?

Thanks again! I do appreciate you taking the time to help me.

##### Share on other sites

#6 ·  Posted (edited)

Here's another way to do it...

```#include <ExcelCOM_UDF.au3>

\$sFilePath = @ScriptDir & "\test.xls"
\$oWorkbook = _ExcelBookOpen(\$sFilePath)
\$oSheet = \$oWorkbook.ActiveSheet

\$sInfo = ""
\$sInfo &= "ScreenTip : " & .ScreenTip
\$sInfo &= "TextToDisplay: " & .TextToDisplay
EndWith
\$sInfo &= @CR & @CR

ConsoleWrite(\$sInfo)```

##### Share on other sites

Ahhhh . . . that's the way I was trying to write it last night. Unsuccessfully.

Thanks again!

##### Share on other sites

You're welcome, glad I was able to help.

##### Share on other sites

You're welcome, glad I was able to help.

#include <ExcelCOM_UDF.au3> ; Include the collection

\$sFilePath = @ScriptDir & "C:\remo.xls"

\$oWorkbook = _ExcelBookOpen(\$sFilePath)

\$oSheet = \$oWorkbook.ActiveSheet

\$sInfo = ""

\$sInfo &= "ScreenTip : " & .ScreenTip

\$sInfo &= "TextToDisplay: " & .TextToDisplay

EndWith

\$sInfo &= @CR & @CR

ConsoleWrite(\$sInfo)

when i run this code - i get this error

Line5

\$oSheet= oWorkbook.Activesheet

\$oSheet= oWorkbook^ERROR

Error : Variable must be of type object

##### Share on other sites

#include <ExcelCOM_UDF.au3> ; Include the collection

\$sFilePath = @ScriptDir & "C:\remo.xls"

\$oWorkbook = _ExcelBookOpen(\$sFilePath)

\$oSheet = \$oWorkbook.ActiveSheet

\$sInfo = ""

\$sInfo &= "ScreenTip : " & .ScreenTip

\$sInfo &= "TextToDisplay: " & .TextToDisplay

EndWith

\$sInfo &= @CR & @CR

ConsoleWrite(\$sInfo)

when i run this code - i get this error

Line5

\$oSheet= oWorkbook.Activesheet

\$oSheet= oWorkbook^ERROR

Error : Variable must be of type object

Did you really leave the dollar sign (\$) off the variable name? Is should be \$oWorkbook.Activesheet.

Assuming that was a typo, if \$oWorkbook is not an object, then _ExcelBookOpen() failed. Was your path to the .xls file correct?

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

##### Share on other sites

Did you really leave the dollar sign (\$) off the variable name? Is should be \$oWorkbook.Activesheet.

Assuming that was a typo, if \$oWorkbook is not an object, then _ExcelBookOpen() failed. Was your path to the .xls file correct?

i checked the path name it is correct. and yes it was a typo error, so still the error persists

##### Share on other sites

i checked the path name it is correct. and yes it was a typo error, so still the error persists

You are suuuuure this is correct...?

\$sFilePath = @ScriptDir & "C:\remo.xls"

If your @ScriptDir is C:\MyScripts then this would give you \$sFilePath = "C:\MyScriptsC:\remo.xls"

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

##### Share on other sites

You are suuuuure this is correct...?

If your @ScriptDir is C:\MyScripts then this would give you \$sFilePath = "C:\MyScriptsC:\remo.xls"

thanks a lot i had figured it out. i had given @ScriptDir without knowing the use of it.