How to code macro to disconnect internet connection?

E

Eric

Does anyone have any suggestions on how to code macro to disconnect internet
connect for macro?
I would like to add a code at the end of macro to disconnect internet
connection, does anyone have any suggestions on how to do it in Excel?
Thanks in advance for any suggestions
Eric
 
J

joel

How are you making the internet connection? do yo mean to close a we
browser, shutdown a dialup connection, kill an ethernet connection. Y
need to be a little bit more specific.

I program in C# and open and close connections all the time. I need t
know a little bit about the connection type to help with some code.
think you want to close an Port to a particular IP address. Yo eithe
want to look at the ARP table or use the Loopback address 127.0.0.1 t
find all the active connections and then close the connection wiht
particular IP address and Port Number.

This task may be easier if you download Visual studio 2008 which i
available from microsoft for free and use either VB Net, C++, or C
which arethe 3 languages available in Studio. visual studio 2008 us
Net 3.4 library and there is plenty of documents in the microsof
website under Net 3.5 showing examples of how to achieve this request.
I have code in C# which can be modified to to this. I got all my cod
from searching the microsoft databases.

There isn't a lot of material on doing this from VBA although it can b
done. If yo have an excel application I recommend open the exce
application from Visual Studio. The C# tutorial in visual Studio had a
example of how to open a workbook which I did in about 15 minutes.
 
E

Eric

I manually connect the internet connection for Excel's macro to run a list of
files, in order to retrieve data from external links. Once all files are
completed updated, I would like to add coding at the end of process to
disconnect the internet connection.
Does anyone have any suggestions on how to do it?

Furthermore, I post this question under following link, but when I do
searching on google, and find my question is replied from other forum, where
I don't see any reply from following links. So I don't know someone reply to
my questions outside this forum, does anyone have why my question is listed
on third party forum outside microsoft?

http://www.microsoft.com/office/com...rosoft.public.excel.programming&lang=en&cr=US

Thanks in advance for any suggestions
Eric
 
J

joel

It sound like all you are doing is to open a webbrowser. So you just
need to close the webbrowser and set the object to nothing

IE.Quit
set IE = nothing



But this may not log you off the application. if you are using another
protocol than a webbrowser then you may need to do something else


To answer you question about your posting appearing in other location.
the websites uses VBN protocol. What the websites does is to register a
port number at an IP address. What registering does is to send send
data from one IP address to another IP address automatically. Doing
this will allow multiple websites to send and receive the postings and
share the postings.

There is also a google formum that gets the same messages and two
microsoft formums. There are slight differences between the various
websites. Google does post all messages from the other sites.
Microsoft has one site which gives email notifications and a 2nd one
that sometimes gives email notifications (this features breaks often at
microsoft). TheCodeCage and very good support people and the site
rarely has problems but either you pay money or don't pay and get
advertisements.
 
E

Eric

I am using Excel to import external links into worksheets, not using IE.
Do you have any suggestions on how to disconnect internet connection using
macro?
Thanks in advance for any suggestions
Eric
 
J

joel

You can't break the links. Either you have to turn the Recalculation
mode off, or repalce the links with values using PasteSpecial and using
as the paste properies values Only which will remove the links forever.
 
E

Eric

Do you have any suggestions on how to disconnect the internet connection
after all external link are updated? I am using boardband modem for
connection.
Do you have any suggestions?
Thanks in advance for any suggestions
Eric
 
J

joel

Are you trying to shutdown the entire modem or just the IP address
where the files are located? I think you would have to shutdown the
modem. You would need to find the name of the process in the Task
Manager and kill the process. It is possible to go through the task
list of active processes and kill the particular process associated with
the modem. You would need to do this by using the
windows\system32\win32.dll


The website below has a similar request using a phone dialer. the code
accesses the Win32.dll using VBA library functions.

'How to terminate process with VBA? - Microsoft Access / VBA answers'
(http://tinyurl.com/y96yzfp)
 
E

Eric

When I am online, there is a monitor's icon to show online status, when I
disconnect the internet connection, I just right click this icon and select
disconnect, and this is what I want to do to disconnect the boardband
connection.
Do you know any trick to do it? which is not involve any IP or modem
hardware setting at all?
Do you have any suggestions?
Thanks in advance for any suggestions
Eric
 
J

joel

it is diffficult wihtout have your PC configuration to be able to
figure out how to shutdown the software. sometimes there are shortcut
keys to perform these tasks and then you would use the Sendkey method
output the shortcut keys. check the Modem documentation to see if there
is a way to use shortcut keys.
 
J

J Pietsch

There are several screen position based macros out there that can be
called from VBA. This might be one of the times to look into those.
Essentially vba can bring focus to taht program and sendkeys,
launching the screen position based recorder macro. J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top