ahha Posted October 4, 2008 Share Posted October 4, 2008 Okay I have tried all of these and all but one work. See code below. ;create excel hyperlinks.au3 #include <Excel.au3> ; Include the Excel collection $oExcel = _ExcelBookNew(1);open up new book (Book1.xls) to play with - default is 3 sheets, Sheet1, Sheet2, Sheet3 MsgBox(0+262144,"","Let's continue?") FileWriteLine("c:\test.txt", "This is a test text file.");put a test.txt create a test.txt file _ExcelHyperlinkInsert($oExcel, "File directory", "c:\test.txt", "", 1, 1); works _ExcelHyperlinkInsert($oExcel, "URL", "http://www.sun.com/", "", 2, 1) ; works _ExcelHyperlinkInsert($oExcel, "Link to another cell", "file:///C:\Book1.xls - Sheet2!A1", "", 3, 1); DOES NOT WORK ;tried "Book1.xls - Sheet2!A1" - does not work ;tried "Sheet2!A1" - does not work _ExcelHyperlinkInsert($oExcel, "New xls", "file:///C:\xxx.xls", "", 4, 1) _ExcelHyperlinkInsert($oExcel, "email", "mailto:testing@test.com?subject=This is a test", "", 5, 1);works MsgBox(0+262144,"","Exit?") _ExcelBookClose($oExcel);don't save Exit Link to comment Share on other sites More sharing options...
picaxe Posted October 5, 2008 Share Posted October 5, 2008 Try_ExcelHyperlinkInsert($oExcel, "Link to another cell", "file:///C:\Book1.xls#Sheet2!A1", "", 3, 1) Link to comment Share on other sites More sharing options...
ahha Posted October 5, 2008 Author Share Posted October 5, 2008 Try_ExcelHyperlinkInsert($oExcel, "Link to another cell", "file:///C:\Book1.xls#Sheet2!A1", "", 3, 1)Thank you - it works perfectly! Now the natural question, how did you know about the # as when I link manually it never showed that. Is there a reference somewhere on Excel functions? Link to comment Share on other sites More sharing options...
ahha Posted October 6, 2008 Author Share Posted October 6, 2008 FYI this open a new copy of Book1.xls _ExcelHyperlinkInsert($oExcel, "Link to another cell", "file:///C:\Book1.xls#Sheet2!A1", "", 3, 1) This uses the existing copy of Book1.xls _ExcelHyperlinkInsert($oExcel, "Link to another cell", "#Sheet2!A1", "", 3, 1) Thanks for the hint above. Problem solved. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now