Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default followhyperlink happening twice

I am using the following statement to run an asp script on my web
site.

ExcelApp.ActiveWorkbook.FollowHyperlink address:=""http://
www.xlrotor.com/internet_update.asp", NewWindow:=True

The above line is actually in a VB6 dll that I call from Excel VBA.
Anyway, the asp script displays a web page and sends me an email. The
page displays in the default browser just as expected, but I get two
emails when this line is called once from Excel.

If I enter the same URL string manually in the browser, I only get one
email. So something goofy is happening with the FollowHyperlink that
I don't understand.

Does anyone know why this would happen?

Thanks,

Brian Murphy
Austin, Texas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default followhyperlink happening twice

Just a wild guess but maybe your code is in some event code and the
event gets triggered 2 times - like in ws_change event and 2 cells get
changed in sequence...

On Jun 22, 1:11*pm, Brian Murphy wrote:
I am using the following statement to run an asp script on my web
site.

ExcelApp.ActiveWorkbook.FollowHyperlink address:=""http://www.xlrotor.com/internet_update.asp", NewWindow:=True

The above line is actually in a VB6 dll that I call from Excel VBA.
Anyway, the asp script displays a web page and sends me an email. *The
page displays in the default browser just as expected, but I get two
emails when this line is called once from Excel.

If I enter the same URL string manually in the browser, I only get one
email. *So something goofy is happening with the FollowHyperlink that
I don't understand.

Does anyone know why this would happen?

Thanks,

Brian Murphy
Austin, Texas


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default followhyperlink happening twice

It's not called from any event procedures. I checked into the
possibility of the code getting executed twice by placing a breakpoint
on it. This confirmed that it's only getting called once.

I'm not 100% sure, but it's possible that every once in a while I only
get one email. But certainly most of the time I get two.

Thanks,

Brian



On Jun 22, 7:55*am, AB wrote:
Just a wild guess but maybe your code is in some event code and the
event gets triggered 2 times - like in ws_change event and 2 cells get
changed in sequence...

On Jun 22, 1:11*pm, Brian Murphy wrote:

I am using the following statement to run an asp script on my web
site.


ExcelApp.ActiveWorkbook.FollowHyperlink address:=""http://www.xlrotor..com/internet_update.asp", NewWindow:=True


The above line is actually in a VB6 dll that I call from Excel VBA.
Anyway, the asp script displays a web page and sends me an email. *The
page displays in the default browser just as expected, but I get two
emails when this line is called once from Excel.


If I enter the same URL string manually in the browser, I only get one
email. *So something goofy is happening with the FollowHyperlink that
I don't understand.


Does anyone know why this would happen?


Thanks,


Brian Murphy
Austin, Texas


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default followhyperlink happening twice

Putting a breakpoint in the routine can sometimes disguise it being called
twice, particularly from different types of "button" events. Maybe include a
debug line or write to a log file. However I don't think you've given us the
whole picture as your code simply opens a web page, no idea where those
emails are coming from.

I know Excel's FollowHyperlink is tempting for its simplicity even in a VB6
dll, but maybe try something like this -

Public Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long

Sub test()
Dim sURL As String
sURL = "http://www.xlrotor.com/internet_update.asp"

Call ShellExecute(GetDesktopWindow(), vbNullString, sURL, _
vbNullString, vbNullString, vbNormalFocus)
End Sub

Regards,
Peter T



"Brian Murphy" wrote in message
...
It's not called from any event procedures. I checked into the
possibility of the code getting executed twice by placing a breakpoint
on it. This confirmed that it's only getting called once.

I'm not 100% sure, but it's possible that every once in a while I only
get one email. But certainly most of the time I get two.

Thanks,

Brian



On Jun 22, 7:55 am, AB wrote:
Just a wild guess but maybe your code is in some event code and the
event gets triggered 2 times - like in ws_change event and 2 cells get
changed in sequence...

On Jun 22, 1:11 pm, Brian Murphy wrote:

I am using the following statement to run an asp script on my web
site.


ExcelApp.ActiveWorkbook.FollowHyperlink
address:=""http://www.xlrotor.com/internet_update.asp", NewWindow:=True


The above line is actually in a VB6 dll that I call from Excel VBA.
Anyway, the asp script displays a web page and sends me an email. The
page displays in the default browser just as expected, but I get two
emails when this line is called once from Excel.


If I enter the same URL string manually in the browser, I only get one
email. So something goofy is happening with the FollowHyperlink that
I don't understand.


Does anyone know why this would happen?


Thanks,


Brian Murphy
Austin, Texas


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default followhyperlink happening twice

Thanks for the great tip, I have a Django database that I am trying to update and I get messages posted twice, so this will work great.

My issue is, I am getting a PtrSafe message when I try to use it.

I hole my own with Excel and VBA, but that message and the MSDN is a bit over my head. Does anyone know what I would need to do to get this to work.

Win7 64bit Excel 2010

Thanks.
Tony
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
FollowHyperlink CLR Excel Programming 6 December 2nd 09 05:35 PM
Why this is happening springwinterfall Charts and Charting in Excel 4 January 9th 05 02:16 PM
what's the Bug....tell me what's happening??? foamfollower Excel Programming 4 February 1st 04 04:04 PM
FollowHyperlink Mike Archer[_3_] Excel Programming 0 December 19th 03 12:26 PM
followhyperlink Mike Archer[_2_] Excel Programming 0 December 18th 03 03:19 PM


All times are GMT +1. The time now is 07:29 PM.

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"