Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2009, 06:50 AM
Authorized User
 
Join Date: Aug 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Put data to another excel open by Shell function

Hi evey one !

1. Can I write some data to another excel open by Shell("c:\EXCEL\EXCEL.EXE",1) ? For example put data to cell "C1".
2. Can I run Worksheet_Change(ByVal Target As Excel.Range) only when cell "A2" change the other cells's value change it not run ?

Many thanks.
 
Old June 29th, 2009, 09:11 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Is there any specific reason for you to use Shell? Why it be done using VBA?

For your second query. Can you try the following:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$2" Then
        MsgBox "Do something"
    Else
        ' Do nothing
    End If
End Sub
Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old June 30th, 2009, 12:04 PM
Authorized User
 
Join Date: Aug 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Shasur !

Thanks very much for your excellent answer on second query.
on first query I use AppActivate funtion to active an workbook open by Shell function the workbook have some command needed to run on time, when the workbook having VBA code AppActivate update data every time

Cheers.
Hoang
 
Old July 5th, 2009, 03:11 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Will the Workbooks_Open event help?

Code:
Private Sub Workbook_Open()
   Sheets(2).Range("c1").Value = "Hoang"
End Sub
Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old July 7th, 2009, 11:32 PM
Authorized User
 
Join Date: Aug 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Shasur !

Thanks very much for your help.

Cheers.
Hoang





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to call shell cmd to open exe on clientside? nana Javascript How-To 6 May 25th, 2006 03:23 AM
how to put result of shell function into variable method Beginning VB 6 1 April 20th, 2006 11:42 AM
Using the Shell Function RAPSR59 Access 1 April 13th, 2005 07:14 AM
shell function problem bml Excel VBA 1 February 12th, 2005 05:42 PM
Shell Function Question SerranoG Access VBA 4 November 12th, 2003 07:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.