Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro is weird!

Sub Auto_Open()

Range("D8").Select

On Error GoTo ErrorHandler

AppActivate "WinWedge - " + MyPort$

On Error GoTo 0

AppActivate Application.Caption
Exit Sub

ErrorHandler:

RetVal = Shell("C:\Program Files\WINWEDGE\WINWEDGE.EXE C:\Program
Files\Winwedge\Comparitor.SW3")
If RetVal = 0 Then
Beep
MsgBox ("Cannot Find WinWedge.Exe")
Exit Sub
Else
Application.Wait Now + TimeValue("00:00:04")
End If
Resume Next
End Sub

Here is the macro i am running! This macro will open a application file
successfully but when it opens i have to click on the program icon on
toolbar and when i do that the icon disappears and then the program
pops up ready to use. I would like for the macro to open the program in
the use state when it opens instead of having to click on icon on
toolbar 1st? ANY HELP WOULD BE GREATLY APPRECIATED!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Macro is weird!

Hello!

Have you tried this?:
RetVal = Shell("C:\Program Files\WINWEDGE\WINWEDGE.EXE C:\Program
Files\Winwedge\Comparitor.SW3", vbMaximizedFocus)

Regards,
Herbert




"toolroomman" wrote:

Sub Auto_Open()

Range("D8").Select

On Error GoTo ErrorHandler

AppActivate "WinWedge - " + MyPort$

On Error GoTo 0

AppActivate Application.Caption
Exit Sub

ErrorHandler:

RetVal = Shell("C:\Program Files\WINWEDGE\WINWEDGE.EXE C:\Program
Files\Winwedge\Comparitor.SW3")
If RetVal = 0 Then
Beep
MsgBox ("Cannot Find WinWedge.Exe")
Exit Sub
Else
Application.Wait Now + TimeValue("00:00:04")
End If
Resume Next
End Sub

Here is the macro i am running! This macro will open a application file
successfully but when it opens i have to click on the program icon on
toolbar and when i do that the icon disappears and then the program
pops up ready to use. I would like for the macro to open the program in
the use state when it opens instead of having to click on icon on
toolbar 1st? ANY HELP WOULD BE GREATLY APPRECIATED!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro is weird!

ok that worked great! now what i want to do is when i receive the data
from my comparator i want to save the data without the macros? i have 3
moduals in this work book. one of them opens the application file and
one of them closes the apllication file and one (using the
Crtl+Shift+R) will save the workbook. when i use the Ctrl+Shift+R it
saves the file but keeps all the macros. i need to know where to put
and what to put in one of the moduals to get rid of the macros when
saved.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macro is weird!

hi,
your error handler is opening the file. the error happens when you try to
activate a application that hasn't been opened yet
I rewrote this a little. you have have to tinker with it
tested. works on my pc. i used word at test.
look up shell in vb help
look up appactivate in vb help
Sub mactest1()
Dim myapp

Range("D8").Select

On Error GoTo ErrorHandler
myapp = Shell("C:\Program Files\Microsoft Office\Office\WINWedge.EXE", 3)
'Application.WindowState = xlMinimized
AppActivate myapp

ErrorHandler:
If Err.Number = 5 Then
Beep
MsgBox ("Cannot Find WinWedge.Exe")
Exit Sub
End If

End Sub

Regards
FSt1

"toolroomman" wrote:

Sub Auto_Open()

Range("D8").Select

On Error GoTo ErrorHandler

AppActivate "WinWedge - " + MyPort$

On Error GoTo 0

AppActivate Application.Caption
Exit Sub

ErrorHandler:

RetVal = Shell("C:\Program Files\WINWEDGE\WINWEDGE.EXE C:\Program
Files\Winwedge\Comparitor.SW3")
If RetVal = 0 Then
Beep
MsgBox ("Cannot Find WinWedge.Exe")
Exit Sub
Else
Application.Wait Now + TimeValue("00:00:04")
End If
Resume Next
End Sub

Here is the macro i am running! This macro will open a application file
successfully but when it opens i have to click on the program icon on
toolbar and when i do that the icon disappears and then the program
pops up ready to use. I would like for the macro to open the program in
the use state when it opens instead of having to click on icon on
toolbar 1st? ANY HELP WOULD BE GREATLY APPRECIATED!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macro is weird!

hi,
see this site
http://www.cpearson.com/excel/vbe.htm

regards
FSt1

"toolroomman" wrote:

ok that worked great! now what i want to do is when i receive the data
from my comparator i want to save the data without the macros? i have 3
moduals in this work book. one of them opens the application file and
one of them closes the apllication file and one (using the
Crtl+Shift+R) will save the workbook. when i use the Ctrl+Shift+R it
saves the file but keeps all the macros. i need to know where to put
and what to put in one of the moduals to get rid of the macros when
saved.


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
weird macro behavior Dave F Excel Discussion (Misc queries) 0 November 30th 06 03:35 PM
Weird Macro Problem Bruce001 Excel Programming 6 August 26th 05 03:20 AM
Subtotal Macro weird actions Bill[_22_] Excel Programming 4 August 5th 04 07:05 PM
Weird template/macro behavior ?? David Excel Programming 0 August 12th 03 04:33 PM
Weird template/macro behavior ?? Tom Ogilvy Excel Programming 0 August 12th 03 04:17 PM


All times are GMT +1. The time now is 02:48 PM.

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

About Us

"It's about Microsoft Excel"