Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA WinHttp.WinHTTPRequest

Posted on 2010-11-17
2
Medium Priority
?
6,274 Views
Last Modified: 2012-05-10
I have in Excel vba

Dim xhr As WinHttp.WinHTTPRequest
   
    Set xhr = CreateObject(WinHttp.WinHTTPRequest)

but this gives me "compile error user defined type not defined.

I must be missing a reference or something like but not too familiar with vba.

Help please
0
Comment
Question by:Philip Pinnell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
spattewar earned 2000 total points
ID: 34156138
you have to put a reference to the Microsoft WinHTTP Services. In your VBA project window go to the menu Tools-> Reference and add the WinHTTP services. Then you should be able to compile. Also in your code you are doing both early and late binding which is not helpful.

If you do not want to add a reference to the services then you can do

Dim xhr As Object    
Set xhr = CreateObject(WinHttp.WinHTTPRequest)

and if you have added the reference then you should get the intellisense when you enter space after the As keyword

Dim xhr As WinHttp.WinHTTPRequest
   
    Set xhr = New WinHTTPRequest

Hope this helps.

0
 
LVL 13

Author Comment

by:Philip Pinnell
ID: 34156580
Thanks

That's what I needed
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question