Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Visual Basic and Excel 2003 and 2007?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
playerbigdog - 28 May 2008 17:59 GMT
Back in 2004 a intern created a Visual Basic program that ran using access
and excel 2003. I am fairly new to Visual Basic and want to implement into
Office 2007. What, if any, are the major differences in code between 2003 and
2007?
Bob Phillips - 28 May 2008 18:16 GMT
There are no major differences in code in the two. 2007 has certain
additions to cope with the extended object model, and certain things have
changed slightly (such as FileSearch no longer works). But all of these are
relatively minor. The big problem lies in the way things work in 2007, the
ribbon is very different than commandbars, charting has been re-written
(re-destroyed some might argue), conditional formatting is very different
and so on and so on. These may impact on your applications, they might not.
Only testing will tell.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Back in 2004 a intern created a Visual Basic program that ran using access
> and excel 2003. I am fairly new to Visual Basic and want to implement into
> Office 2007. What, if any, are the major differences in code between 2003
> and
> 2007?
playerbigdog - 28 May 2008 18:38 GMT
Sounds great. Here is the particular part of the code i am haveing problems
with.  If temp1 = 43 Or myVar3 = "43" Then
   Range("B2:E8758").Select
   Charts.Add
   ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
       "Chart_1"
   ActiveChart.SetSourceData Source:=Sheets(myVar1).Range("B2:E8758"), _
       PlotBy:=xlColumns
   Else
   Range("B2:E8758").Select
   Charts.Add
   ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= _
       "Chart_1"
   ActiveChart.SetSourceData Source:=Sheets(myVar1).Range("B2:E8758"), _
       PlotBy:=xlColumns
Where the else starts, is where my problems start. What is the new the chart
information?

> There are no major differences in code in the two. 2007 has certain
> additions to cope with the extended object model, and certain things have
[quoted text clipped - 10 lines]
> > and
> > 2007?
Bob Phillips - 28 May 2008 20:44 GMT
I can't test that because I don't have a custom chart type of Chart_1. Is
that your problem too?

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Sounds great. Here is the particular part of the code i am haveing
> problems
[quoted text clipped - 36 lines]
>> > and
>> > 2007?
playerbigdog - 28 May 2008 21:32 GMT
It could be i am not terribley sure. The chart is based off a user preference
but the data for it is drawn from a database where i work. Would it be easier
if i just picked a chart to use instaed of having it as a user preference?

> I can't test that because I don't have a custom chart type of Chart_1. Is
> that your problem too?
[quoted text clipped - 39 lines]
> >> > and
> >> > 2007?
Bob Phillips - 28 May 2008 22:08 GMT
It would be a good idea IMO. It would certainly get you started.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> It could be i am not terribley sure. The chart is based off a user
> preference
[quoted text clipped - 52 lines]
>> >> > and
>> >> > 2007?
Andy Pope - 29 May 2008 09:59 GMT
Hi,

xl2007 does not support custom chart types.
You maybe be able to use the new ApplyChartTemplate method. Other wise you
will need to apply the custom formatting within the code.

Cheers
Andy

Signature

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

>I can't test that because I don't have a custom chart type of Chart_1. Is
>that your problem too?
[quoted text clipped - 41 lines]
>>> > and
>>> > 2007?
playerbigdog - 29 May 2008 13:03 GMT
OK, thanks guys. I think I am getting it slowly figured out!

> Hi,
>
[quoted text clipped - 50 lines]
> >>> > and
> >>> > 2007?
playerbigdog - 29 May 2008 15:09 GMT
Ok, I ran into one more snage. I am trying to set up the sorted columns. Can
you tell if there is anything wrong with the code the Selection.Sort area?

Range("C2:E8760").Select
   Selection.Copy
   Range("L2").Select
   ActiveSheet.Paste
   Columns("L:L").Select
   Application.CutCopyMode = False
   Selection.Sort Key1:=Range("L1"), Order1:=xlAscending, Header:=xlGuess, _
       OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
   Selection.Sort Key1:=Range("L1"), Order1:=xlDescending, Header:=xlGuess, _
       OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
   Columns("M:M").Select
   Selection.Sort Key1:=Range("M1"), Order1:=xlAscending, Header:=xlGuess, _
       OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
   Selection.Sort Key1:=Range("M1"), Order1:=xlDescending, Header:=xlGuess, _
       OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
   Columns("N:N").Select
   Selection.Sort Key1:=Range("N1"), Order1:=xlDescending, Header:=xlGuess, _
       OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

> OK, thanks guys. I think I am getting it slowly figured out!
>
[quoted text clipped - 52 lines]
> > >>> > and
> > >>> > 2007?
Andy Pope - 29 May 2008 19:03 GMT
You should be alright with,

Columns("L:L").Sort Key1:=Range("L1"), Order1:=xlAscending, _
      Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
      Orientation:=xlTopToBottom

Does the code you posted not work or raise an error?

Cheers
Andy

> Ok, I ran into one more snage. I am trying to set up the sorted columns. Can
> you tell if there is anything wrong with the code the Selection.Sort area?
[quoted text clipped - 74 lines]
>>>>>>>and
>>>>>>>2007?

Signature

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

playerbigdog - 29 May 2008 19:10 GMT
It just raised a run-rime error but i will try your code and see how it works.

> You should be alright with,
>
[quoted text clipped - 85 lines]
> >>>>>>>and
> >>>>>>>2007?
playerbigdog - 29 May 2008 19:45 GMT
When i try to put the code into the system and run it; I get the an error
saying that it has disconnected me from the clients (I am guessing that is
the database) and then takes me straight to that piece of code when i click
debug. Why is it disconnecting?

> You should be alright with,
>
[quoted text clipped - 85 lines]
> >>>>>>>and
> >>>>>>>2007?
Andy Pope - 29 May 2008 20:05 GMT
I have no idea. Can not see how that error is related to the sort part.

Do you get the error if you manually try and sort?

> When i try to put the code into the system and run it; I get the an error
> saying that it has disconnected me from the clients (I am guessing that is
[quoted text clipped - 90 lines]
>>>>>>>>>and
>>>>>>>>>2007?

Signature

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.