Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open other applications using code
I want to have Excel open Windows Explorer to a specific drive location, ie
C:\MyFolder. I also want Excel to open Internet Explorer to a specific intranet site. Can either of these actions be done thru Excel VB? Thanks for any help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open other applications using code
I am assuming that you want to import and Excel file into an existing
worksheet. Is that right? Sub Import() Dim Wb1 As Workbook Dim Wb2 As Workbook Dim x As Long Dim FilesToOpen FilesToOpen = Application.GetOpenFilename _ (FileFilter:="Text Files (*.xls), *.xls", _ MultiSelect:=True, Title:="Excel Files to Open") Set Wb1 = ActiveWorkbook For x = LBound(FilesToOpen) To UBound(FilesToOpen) Set Wb2 = Workbooks.Open(Filename:=FilesToOpen(x)) Wb2.Worksheets.Copy _ After:=Wb1.Sheets(Wb1.Sheets.Count) Wb2.Close False Next x 'Sheets("Control Sheet").Select End Sub Next, turn on the macro recorder, click Data Import External data New Web Query. Then, type any URL into the address bar. Search around until you find what you want, click the little yellow arrow (next to the data that you want to import) and it will turn into a green check box. Finally, click on the 'Import' button in the lower right hand side of the active window. I did this and got the code below: Sub Macro1() With ActiveSheet.QueryTables.Add(Connection:="URL;http://finance.yahoo.com", _ Destination:=Range("A1")) .Name = "finance.yahoo" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingNone .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With End Sub Regards, Ryan--- -- RyGuy "SJW_OST" wrote: I want to have Excel open Windows Explorer to a specific drive location, ie C:\MyFolder. I also want Excel to open Internet Explorer to a specific intranet site. Can either of these actions be done thru Excel VB? Thanks for any help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Open other applications using code
On Aug 6, 9:02*am, SJW_OST wrote:
I want to have Excel open Windows Explorer to a specific drive location, ie C:\MyFolder. I also want Excel to open Internet Explorer to a specific intranet site. Can either of these actions be done thru Excel VB? Thanks for any help. All these can be done. u can use Sub test() ActiveWorkbook.FollowHyperlink Address:="H:\", _ NewWindow:=True End Sub IF you go to the webpage of say google then just use Sub test() ActiveWorkbook.FollowHyperlink Address:="http://www.google.com", _ NewWindow:=True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why does Exel open much slower than other applications? | Excel Discussion (Misc queries) | |||
Can't open Excel files from other applications | Excel Discussion (Misc queries) | |||
Open non MS applications | Excel Programming | |||
check Open Excel applications | Excel Programming | |||
Macro to open other applications | Excel Programming |