Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Upon First executing Macro Application opens in windows taskbar

0

Upon first opening excel and executing vba Macro the internet explorer application opens and flashes in windows taskbar. If I left click it opens as required. 

If I close the internet explorer window and re-execute the macro then the internet explorer window opens by it's self.

My question is how can I make the internet window open upon first opening excel.

Answer
Discuss

Answers

0

The program with which Windows opens can be set in the Startup folder which will be located in different places depending upon your version of Windows. I have it at

C:\Users\[Username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs

If the AppData folder doesn't show in your Windows explorer click the View tab at the top of the Explorer window and check Hidden items to make it visible.

I believe if you add "ieexplore.exe" to the Startup folder it will have the effect of starting that program when Windows is loaded (haven't tried - my Startup folder is empty).

Discuss

Discussion

Thanks for trying but it did not work
This is Driving me Nuts Dec 2, '19 at 9:57 pm
I was hoping that the easy way would be good enough for you. But you are right. My solution isn't a 100% correct answer to your question. This has to do with your question being 100% imprecise.
"how can I make the internet window open upon first opening excel". The answer is that you can't. But you also can't open Excel without opening a workbook. And it does seem that you have a workbook with code in it. So, what do you want? Do you want Excel to open that particular workbook whenever Excel starts? Or do you want to start IE whenever that workbook is opened? With my suggestion you could open Excel when you start your PC and make Excel open with a particular workbook which opens IE. When both IE and Excel workbook are open, which application do you wish to see on your screen.
All of this would be controlled by code residing in the workbook. Please post that workbook so that we can look at the code.
Variatus (rep: 4889) Dec 2, '19 at 11:20 pm
You are correct it is very difficult problem to explain. I have included my code below.

But first let me have another go at explaining - I have created a button using the form control (I have correctly assigned the macro to the button) and when I click on the button it opens the web page in the task bar. When I excute it from the visual bacic window (F11) it opens in it own window. 


Option Explicit   Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long   Const SW_SHOW = 5   Sub ie()   Dim ie As InternetExplorer Dim retval As Long Dim URL As String   URL = "google.com" Set ie = New InternetExplorer     With ie .Top = 0 .Left = 0 .Width = 1400 .Height = 1000 .AddressBar = 0 .Toolbar = 0     .navigate URL .Visible = True     Do Until Not .Busy And .readyState = 4 DoEvents Loop   End With     End Sub
This is Driving me Nuts Dec 3, '19 at 11:05 pm
Thank for making me think after I wrote my last reply I found the solutiion under the Developer tab - Macro Security - Macro Settings - Check box (Trust access to the VBA project object model)

Problem solved Thank you very much


This is Driving me Nuts Dec 3, '19 at 11:25 pm
Bear in mind that allowing access to the VB Project object enables anyone or anything accessing your computer from the web to run code on it. You shouldn't allow such access except for very limited time spans while you are, for example, allowing your own code to modify your own code, meaning to allow the execution of code that writes code where you know both.
How that setting works to cure the problem you described is not clear to me but it seems accidental. Your problem seems to stemp from inadequate control of the ActiveWindow. When you open Excel the ActiveWindow shows the Excel application. When Excel's VBA opens the IE that becomes the ActiveWindow. Not clear what the API function is supposed to do. In the fraction of your code that you shared it isn't called but whenever it is it would interfere. Therefore the timing of that call is important.
Variatus (rep: 4889) Dec 4, '19 at 12:25 am
Add to Discussion
0

Hi Nuts

here is some code I use that seems to work.

Pick out the bits you need. I guess the visible = true would be the bit

TryThis = Worksheets("Servers").Cells(InRow, 2).Value
    While TryThis <> ""

       Application.DisplayStatusBar = True
       Application.StatusBar = "Checking " & TryThis
        Worksheets("Servers").Cells(InRow, 3) = "Working"
        WendCount = 0
        'Requires Microsoft Internet Controls to be activated. Tools > References > Microsoft Internet Controls
       Set ie = New InternetExplorerMedium
        ie.navigate TryThis
        ie.Visible = True
       IEState = ie.ReadyState
Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login