Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default web box address

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default web box address

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default web box address

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default web box address

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default web box address

Again the statement below isn't a good statement. You have two equal
statements with an OR . what is the Or doing. There is no "IF". Correct
this statement!

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"



"Atishoo" wrote:

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

But that statement is only part of a macro used to create and place the web
box it doesnt have any current role in my workbook, and it is not a working
part of the macro but a direction to the user, that statement aside the web
boxes are in place and working i just cant retrieve the web address

"Joel" wrote:

Again the statement below isn't a good statement. You have two equal
statements with an OR . what is the Or doing. There is no "IF". Correct
this statement!

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"



"Atishoo" wrote:

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default web box address

I think you are getting the filename as the default browser addrress because
yuo never changed it. some of you code is dependant on the value of
BrowserPresent (there is an IF stement using this value) and I'm not sure
what the value is set to. fix the obvious problems before you look at the
more difficult problems. You never know how bad lines of code are effecting
the rest of your code.

"Atishoo" wrote:

But that statement is only part of a macro used to create and place the web
box it doesnt have any current role in my workbook, and it is not a working
part of the macro but a direction to the user, that statement aside the web
boxes are in place and working i just cant retrieve the web address

"Joel" wrote:

Again the statement below isn't a good statement. You have two equal
statements with an OR . what is the Or doing. There is no "IF". Correct
this statement!

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"



"Atishoo" wrote:

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

hm! didnt think of it that way! ill have a crack tonight!
thanks John

"Joel" wrote:

I think you are getting the filename as the default browser addrress because
yuo never changed it. some of you code is dependant on the value of
BrowserPresent (there is an IF stement using this value) and I'm not sure
what the value is set to. fix the obvious problems before you look at the
more difficult problems. You never know how bad lines of code are effecting
the rest of your code.

"Atishoo" wrote:

But that statement is only part of a macro used to create and place the web
box it doesnt have any current role in my workbook, and it is not a working
part of the macro but a direction to the user, that statement aside the web
boxes are in place and working i just cant retrieve the web address

"Joel" wrote:

Again the statement below isn't a good statement. You have two equal
statements with an OR . what is the Or doing. There is no "IF". Correct
this statement!

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"



"Atishoo" wrote:

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address



  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

Nope its no blinkin good! kept it simple as possible! just added a browser
manually from the control toolbox to a blank workbook set the address via
navigate 2 on a workbook open event and still I cant get the bloomin
displayed site url to return!
what the heck am i doing wrong ??? i have an idea though! I work on the 4th
floor and its one heck of a drop for a computer!

"Joel" wrote:

I think you are getting the filename as the default browser addrress because
yuo never changed it. some of you code is dependant on the value of
BrowserPresent (there is an IF stement using this value) and I'm not sure
what the value is set to. fix the obvious problems before you look at the
more difficult problems. You never know how bad lines of code are effecting
the rest of your code.

"Atishoo" wrote:

But that statement is only part of a macro used to create and place the web
box it doesnt have any current role in my workbook, and it is not a working
part of the macro but a direction to the user, that statement aside the web
boxes are in place and working i just cant retrieve the web address

"Joel" wrote:

Again the statement below isn't a good statement. You have two equal
statements with an OR . what is the Or doing. There is no "IF". Correct
this statement!

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"



"Atishoo" wrote:

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 267
Default web box address

Yeah!!
think I may not have explained myself at all properly Have just sussed it
this doe the trick:-

Cells(ActiveCell.Row, "ar").Value = Me.WebBrowser2.LocationURL

thanks John

"Joel" wrote:

Again the statement below isn't a good statement. You have two equal
statements with an OR . what is the Or doing. There is no "IF". Correct
this statement!

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"



"Atishoo" wrote:

Have got the browsers present at the top of my board and working great! they
just display as windows, no address bar or anything, i control the address by
the active row and want to do the opposite (set the address to the active row
via a command button that will deliver the address that the user has
navigated to in the column "ar" in the active row) thereby the user can set
whos info the browser shows automatically, if that makes sense! Only trouble
is that no matter how I twist it i keep getting the workbooks address on the
C drive instead! Might be defeated by this one!

"Joel" wrote:

What is this statement doing?

BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object)
= "WebBrowser"

You can also open an Explorer object by simply doing this

anOLEObj.activate

"Atishoo" wrote:

Oh this problem is driving me nuts!
Maybe this might shed some light?
I used the folowing sub to create my browsers for me does this make a
difference to the way i should be retrieving the displayed web page?


Sub addbrowser()
'
' addbrowser Macro
'
'Application.CommandBars("Control Toolbox").Visible = True
Dim anOLEObj As OLEObject, BrowserPresent As Boolean
For Each anOLEObj In ActiveSheet.OLEObjects
BrowserPresent = BrowserPresent Or TypeName(anOLEObj.Object) =
"WebBrowser"
Next anOLEObj
If Not BrowserPresent Then
Set anOLEObj =
ActiveSheet.OLEObjects.Add(ClassType:="Shell.Explo rer.2", Link:=False, _
DisplayAsIcon:=False, Left:=461.25, Top:=293.25, Width:=190.5,
Height _
:=95.25)
anOLEObj.Object.Name = "WebBrowser1"
End If
ActiveSheet.Shapes("WebBrowser1").OLEFormat.Object .Object.Navigate2 _
"http://www.dh.gov.uk"

'
End Sub

"Joel" wrote:

Th eactive x form browser defaults to the workbook if not set to something
else.

"Atishoo" wrote:

thanks! still got same result might it be because im using a form webbrowser
not an active x webbrowser

"Joel" wrote:

Not sure why you aren't getting the address in the web box. This code works
for me.

Sub text()

End Sub
webaddress = ""
Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.text
Exit For
End If

Next Item
Cells(ActiveCell.Row, "ar").Value = webaddress

End Sub


"Atishoo" wrote:

tried that last code and it seems to return the address of the whole excell
file (c:\folder\epb.xls) rather than the web page address

"Atishoo" wrote:

Is there no way to just return the web address in a cell?? i know how to set
the web address using navigate2! surely there must be a way to return the
address just as you would an objects value? then again maybe there isnt?

"Joel" wrote:

this will work. I'm not sure how to direrctly get the combox from the
command bar because it doesn't have a name. It is item 10 in my workbook but
not sure if that will always be the same item. You can also get all the web
addresses from the combobox if you need them.


Set WebBar = Application.CommandBars("Web").Controls
For Each Item In WebBar
If Item.Type = msoControlComboBox Then
webaddress = Item.Text
End If

Next Item

"Atishoo" wrote:

sorry i should have been more specific!
i meant the web address that the web box is currently viewing.

"Joel" wrote:

You have a few problems with the code below

1) A shape doesn't have an address. the location of the shape is determined
by 4 parameters which are points (or pixels) position.

left, top, width, height

2) If you have an Oleobject like a textbox, listbox, checkbox they have both
shape information and object information. The data inside the items will be
the Oleobjects.object while the picture type information will be shapes.

ActiveSheet.Oleobjects("WebBrowser2").object.Text - if item was a textbox

"Atishoo" wrote:

Hi how do I return a web browser address into a cell as per the following
example??


Cells(ActiveCell.Row, "ar").Value = ActiveSheet.Shapes("WebBrowser2").Address

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I avoid excel change absolute address to relative address Miguel Excel Discussion (Misc queries) 3 May 10th 07 11:18 PM
long address list, name-address-city, listed vertically, how do y. kb Excel Discussion (Misc queries) 2 March 4th 05 12:48 AM
How do I import Office address book to Outlook Express address bo. snnorp Excel Discussion (Misc queries) 2 February 22nd 05 11:47 AM
How to insert an address from Outlook 2003 address book ? Dubois Excel Programming 0 September 27th 04 09:26 AM
LINKING Address cells from an EXCEL spreadsheet to fill MapQuest Address Info Duane S. Meyer Excel Programming 0 August 30th 03 12:16 AM


All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"