PC Review


Reply
Thread Tools Rate Thread

Code Event Criteria

 
 
tighe
Guest
Posts: n/a
 
      3rd Jun 2010
All,

how can, with the code below, have the f![Location] = Filename line to only
run if everything else occured?

Function SaveAppItem()
Set f = Screen.ActiveForm

surl = f![Hyperlink]
Filename = "\\Bcp\bcp\cmcc\cmcdb\20080922_CMCDB2\Documents\CE\Appendix\" &
f![UpdateNum] & ".pdf"

'With CreateObject("Wscript.Shell")
'Shell ("explorer.exe Filename")
Sleep (3000)
Dim oIExplorer: Set oIExplorer = CreateObject("InternetExplorer.Application")
oIExplorer.Navigate surl
oIExplorer.Visible = True
Sleep (3000)
Do: Loop Until oIExplorer.ReadyState = READYSTATE_COMPLETE
Sleep (2000)
'AppActivate ("InternetExplorer.Application")
'WshShell.AppActivate ("InternetExplorer.Application")

Sendkeys "+^{s}", True
Sleep (2000)
Sendkeys (Filename), True
Sleep (2000)
Sendkeys "{Enter}", True
Sleep (3000)

oIExplorer.Quit
f![Location] = Filename ' this event as long as everything occured
DoCmd.RunCommand (acCmdSaveRecord)

End Function
 
Reply With Quote
 
 
 
 
Paolo
Guest
Posts: n/a
 
      3rd Jun 2010
Hi tighe,
I think you can try inserting a doevents commands before the f![Location] =
Filename line so

....all your function
Sleep (2000)
Sendkeys "{Enter}", True
Sleep (3000)

oIExplorer.Quit
doevents
f![Location] = Filename ' this event as long as everything occured
DoCmd.RunCommand (acCmdSaveRecord)

End Function

HTH Paolo

"tighe" wrote:

> All,
>
> how can, with the code below, have the f![Location] = Filename line to only
> run if everything else occured?
>
> Function SaveAppItem()
> Set f = Screen.ActiveForm
>
> surl = f![Hyperlink]
> Filename = "\\Bcp\bcp\cmcc\cmcdb\20080922_CMCDB2\Documents\CE\Appendix\" &
> f![UpdateNum] & ".pdf"
>
> 'With CreateObject("Wscript.Shell")
> 'Shell ("explorer.exe Filename")
> Sleep (3000)
> Dim oIExplorer: Set oIExplorer = CreateObject("InternetExplorer.Application")
> oIExplorer.Navigate surl
> oIExplorer.Visible = True
> Sleep (3000)
> Do: Loop Until oIExplorer.ReadyState = READYSTATE_COMPLETE
> Sleep (2000)
> 'AppActivate ("InternetExplorer.Application")
> 'WshShell.AppActivate ("InternetExplorer.Application")
>
> Sendkeys "+^{s}", True
> Sleep (2000)
> Sendkeys (Filename), True
> Sleep (2000)
> Sendkeys "{Enter}", True
> Sleep (3000)
>
> oIExplorer.Quit
> f![Location] = Filename ' this event as long as everything occured
> DoCmd.RunCommand (acCmdSaveRecord)
>
> End Function

 
Reply With Quote
 
tighe
Guest
Posts: n/a
 
      3rd Jun 2010
paolo,

thank you. i also decided to check the file that is suppoosed to be created
and have a msg box depending on results.

"Paolo" wrote:

> Hi tighe,
> I think you can try inserting a doevents commands before the f![Location] =
> Filename line so
>
> ...all your function
> Sleep (2000)
> Sendkeys "{Enter}", True
> Sleep (3000)
>
> oIExplorer.Quit
> doevents
> f![Location] = Filename ' this event as long as everything occured
> DoCmd.RunCommand (acCmdSaveRecord)
>
> End Function
>
> HTH Paolo
>
> "tighe" wrote:
>
> > All,
> >
> > how can, with the code below, have the f![Location] = Filename line to only
> > run if everything else occured?
> >
> > Function SaveAppItem()
> > Set f = Screen.ActiveForm
> >
> > surl = f![Hyperlink]
> > Filename = "\\Bcp\bcp\cmcc\cmcdb\20080922_CMCDB2\Documents\CE\Appendix\" &
> > f![UpdateNum] & ".pdf"
> >
> > 'With CreateObject("Wscript.Shell")
> > 'Shell ("explorer.exe Filename")
> > Sleep (3000)
> > Dim oIExplorer: Set oIExplorer = CreateObject("InternetExplorer.Application")
> > oIExplorer.Navigate surl
> > oIExplorer.Visible = True
> > Sleep (3000)
> > Do: Loop Until oIExplorer.ReadyState = READYSTATE_COMPLETE
> > Sleep (2000)
> > 'AppActivate ("InternetExplorer.Application")
> > 'WshShell.AppActivate ("InternetExplorer.Application")
> >
> > Sendkeys "+^{s}", True
> > Sleep (2000)
> > Sendkeys (Filename), True
> > Sleep (2000)
> > Sendkeys "{Enter}", True
> > Sleep (3000)
> >
> > oIExplorer.Quit
> > f![Location] = Filename ' this event as long as everything occured
> > DoCmd.RunCommand (acCmdSaveRecord)
> >
> > End Function

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event's code runs to completion before another event's code is entered? Academia Microsoft VB .NET 8 1st Nov 2007 07:13 PM
creating event handler in unmanaged c++ code for event in managed code Mayur Microsoft C# .NET 0 30th Aug 2006 02:01 PM
creating event handler in unmanaged c++ code for event in managed code Mayur Microsoft VC .NET 0 30th Aug 2006 01:22 PM
How to make double click event to call and execute the mouseup event code techsatish@gmail.com Microsoft VB .NET 2 25th Aug 2006 05:43 PM
Can I stop code in a Worksheet_Change event with a Worbook_Deactivate event code? Ronaldo Microsoft Excel Programming 0 17th Nov 2004 05:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:59 PM.