PC Review


Reply
Thread Tools Rate Thread

Drawing Objects with vba and workbook/worksheet

 
 
eholz1
Guest
Posts: n/a
 
      9th Apr 2008
Hello Usenet group Exelerometers,

I am using vba to draw a circle over a 2-cell range on a worksheet
(thank you for the tip on how to do this).

It seems that I cannot draw my circle on a worksheet in a workbook.
Does the worksheet in the workbook have to be active (aka ActiveSheet)
in order for
drawing to take place?

I have two workbooks - one is the workbook with a worksheet with
buttons, etc, and a bunch of VBA code to make things happen.
I click a button to open an existing workbook. None of the
sheets in the workbook I open are active. I click another button on
my sheet, and it performs some calculations on the book I opened. I
would like to draw a circle over a cell or cells after the calculation
process, but without making the various sheets active.

Thanks,

eholz1
 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      9th Apr 2008
I avoid using the active statement. You can refgerence any object without
acttivating (there are some rare exceptions).

with thisworkbook.sheets("sheet1")
.Range("A1") = 5
end with

workbooks.open filename:="c:\abc.xls"
set newbk = activeworkbook
with newbk.sheets("sheet1")
.Range("A1") = 5
end with


the same thing will work with shapes.

"eholz1" wrote:

> Hello Usenet group Exelerometers,
>
> I am using vba to draw a circle over a 2-cell range on a worksheet
> (thank you for the tip on how to do this).
>
> It seems that I cannot draw my circle on a worksheet in a workbook.
> Does the worksheet in the workbook have to be active (aka ActiveSheet)
> in order for
> drawing to take place?
>
> I have two workbooks - one is the workbook with a worksheet with
> buttons, etc, and a bunch of VBA code to make things happen.
> I click a button to open an existing workbook. None of the
> sheets in the workbook I open are active. I click another button on
> my sheet, and it performs some calculations on the book I opened. I
> would like to draw a circle over a cell or cells after the calculation
> process, but without making the various sheets active.
>
> Thanks,
>
> eholz1
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      9th Apr 2008
Follow Joel's advice, and identify any instance of "select" or "selection"
or "active" in your code as a spot that needs attention.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Joel" <(E-Mail Removed)> wrote in message
news:51D51B4F-EC81-4539-8AAA-(E-Mail Removed)...
>I avoid using the active statement. You can refgerence any object without
> acttivating (there are some rare exceptions).
>
> with thisworkbook.sheets("sheet1")
> .Range("A1") = 5
> end with
>
> workbooks.open filename:="c:\abc.xls"
> set newbk = activeworkbook
> with newbk.sheets("sheet1")
> .Range("A1") = 5
> end with
>
>
> the same thing will work with shapes.
>
> "eholz1" wrote:
>
>> Hello Usenet group Exelerometers,
>>
>> I am using vba to draw a circle over a 2-cell range on a worksheet
>> (thank you for the tip on how to do this).
>>
>> It seems that I cannot draw my circle on a worksheet in a workbook.
>> Does the worksheet in the workbook have to be active (aka ActiveSheet)
>> in order for
>> drawing to take place?
>>
>> I have two workbooks - one is the workbook with a worksheet with
>> buttons, etc, and a bunch of VBA code to make things happen.
>> I click a button to open an existing workbook. None of the
>> sheets in the workbook I open are active. I click another button on
>> my sheet, and it performs some calculations on the book I opened. I
>> would like to draw a circle over a cell or cells after the calculation
>> process, but without making the various sheets active.
>>
>> Thanks,
>>
>> eholz1
>>



 
Reply With Quote
 
eholz1
Guest
Posts: n/a
 
      10th Apr 2008
On Apr 9, 2:33 pm, "Jon Peltier" <jonxlmv...@SPAMpeltiertech.com>
wrote:
> Follow Joel's advice, and identify any instance of "select" or "selection"
> or "active" in your code as a spot that needs attention.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutions
> Peltier Technical Services, Inc. -http://PeltierTech.com
> _______
>
> "Joel" <J...@discussions.microsoft.com> wrote in message
>
> news:51D51B4F-EC81-4539-8AAA-(E-Mail Removed)...
>
> >I avoid using the active statement. You can refgerence any object without
> > acttivating (there are some rare exceptions).

>
> > with thisworkbook.sheets("sheet1")
> > .Range("A1") = 5
> > end with

>
> > workbooks.open filename:="c:\abc.xls"
> > set newbk = activeworkbook
> > with newbk.sheets("sheet1")
> > .Range("A1") = 5
> > end with

>
> > the same thing will work with shapes.

>
> > "eholz1" wrote:

>
> >> Hello Usenet group Exelerometers,

>
> >> I am using vba to draw a circle over a 2-cell range on a worksheet
> >> (thank you for the tip on how to do this).

>
> >> It seems that I cannot draw my circle on a worksheet in a workbook.
> >> Does the worksheet in the workbook have to be active (aka ActiveSheet)
> >> in order for
> >> drawing to take place?

>
> >> I have two workbooks - one is the workbook with a worksheet with
> >> buttons, etc, and a bunch of VBA code to make things happen.
> >> I click a button to open an existing workbook. None of the
> >> sheets in the workbook I open are active. I click another button on
> >> my sheet, and it performs some calculations on the book I opened. I
> >> would like to draw a circle over a cell or cells after the calculation
> >> process, but without making the various sheets active.

>
> >> Thanks,

>
> >>eholz1


Hello Guys,

Thanks for this info - it will change my code accordingly.

eholz1
 
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
Drawing Objects =?Utf-8?B?cGFuNjU=?= Microsoft Excel Programming 4 4th Sep 2006 03:16 AM
No drawing canvas so I can still use the objects for drawing! =?Utf-8?B?WGFuZGVyYWxleDc=?= Microsoft Access Form Coding 1 12th Jan 2006 09:46 PM
Cutting Drawing Objects =?Utf-8?B?TG9zdE5Gb3VuZA==?= Microsoft Excel Misc 3 12th Aug 2005 05:35 PM
Drawing Objects Ronald Dodge Microsoft Word Document Management 5 5th Feb 2004 02:17 PM
Default Drawing Objects David Saprkman Microsoft Powerpoint 1 25th Nov 2003 02:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:15 PM.