I tried ‘record macro’ but the section I wanted to capture was remarked out with little to no detail.
I’m looking to create a macro where I can update a link and run through the selection wizard [or bypass and update/refresh directly]
Thanks
I tried ‘record macro’ but the section I wanted to capture was remarked out with little to no detail.
I’m looking to create a macro where I can update a link and run through the selection wizard [or bypass and update/refresh directly]
Thanks
This is what I came up with - goes through each sheet, copying the concatenated URL and uses it to import the External data. 16 tabs takes about 7 min to complete, much faster and WAY less keystrokes than doing each sheet manually.
sub tabSwitch
dim document as object
dim dispatcher as object
dim oAddress as Object
dim sheet as Object
dim oSheets as Object
dim n as Long
document = ThisComponent
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oSheets = ThisComponent.Sheets
' count number of sheets and set pointer for last one - allows for growth
NumSheets = (oSheets.Count - 1)
' loop through each sheet
For n = 1 to NumSheets
' set active sheet
sheet = document.Sheets(n)
' set cell to insert Link External Data
oAddress = sheet.getCellByPosition( 4, 33 ).getCellAddress()
' insert at (cell, url, what HTML, default, default) defaults were what the sample had and I didn't change them
document.AreaLinks.insertAtPosition( oAddress, sheet.getCellByPosition(3, 33).String, "HTML_tables", "calc_HTML_WebQuery", "0 0" )
Next n
end sub