Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 851
  • Last Modified:

Creating an Excel spreadsheet within VB

I am trying to put a shape into a spreadsheet.  I have no problems creating the spreadsheet, but I am trying to add an auto shape using the command:
   ".Shapes.AddShape(msoShapeOval, 341.4, 146.4, 121.2, 116.4)".
VB doesn't like the "msoShapeOval"  keyword.  Does anyone have the definitions of the msoAutoShapeTypes?
0
TopCatOnyx
Asked:
TopCatOnyx
  • 4
  • 3
  • 3
2 Solutions
 
Erick37Commented:
Private Const msoShapeOval = 9
0
 
TopCatOnyxAuthor Commented:
Thanks, is there a list of all the constants for the msoShapeTypes somewhere?
0
 
RogueSolutionsCommented:

Add a reference to Microsoft Office 9.0 (or 10.0, whatever you have) and you should find the constants become available to you.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Erick37Commented:
Add a reference to "Microsoft Office 10 Object Library"

Then bring up the Object Browser by pressing F2 and search for msoAutoShapeType

Or in your code you can type:

Office.MsoAutoShapeType.msoShapeOval
0
 
TopCatOnyxAuthor Commented:
Thanks, I added a referance to Microsoft Office, and it broke my referance for ADODB (I'm using SQL also).  Now I can't restore the ADODB referance   Now I get "User defined type not defined" for "Global dbData as ADODB.Connection".  Removing the referance to MS Office didn't fix the problem.  This was working fine before adding the referance to MS Office 9.0 Object Library.  Any thoughts?
0
 
Erick37Commented:
>>Now I can't restore the ADODB referance<<

What's the error?
0
 
RogueSolutionsCommented:

So, you've taken the Reference to MS Office off again (i.e. unchecked it) and made sure you aren't using any mso constants (for now).  

Is the Microsoft Active Data Objects reference still checked?  (it may be version 2.1, 2.5, etc. depends on your machine).  If not you'll need to re-check it.

Personally, I'd then save my project and close off VB and restart to make sure it wasn't messing around.  No need to reboot or anything that drastic.

Hopefully that should help.  The MS Office reference shoudln't have had that effect, are you sure nothing else changed?
0
 
Erick37Commented:
0
 
TopCatOnyxAuthor Commented:
The error is: "User defined type not defined" for "Global dbData as ADODB.Connection".  I don't see a referance for "Microsoft Active Data Objects", however, I do have Microsoft  DAO 3.6 Object Library checked, as well as Micorsoft Data Binding Collection.  I have unchecked the MS Office referance, saved, closed and reopened the  project, and I still get the error.
0
 
RogueSolutionsCommented:

DAO is the older database connection stuff.  You may have both types of connectivity going on within your application but usually you wouldn't need DAO if you are working with ADO.  Leave it in for now.

You will need a reference to the Microsoft ActiveX Data Objects (either 2.1, or 2.5).  If you don't have either of these then let us know what you do have under Microsoft ActiveX Data Objects.

If you have any other apps you have written, open them and go see what ADO reference they have.

Has this app ever run before?  Maybe the reference has never been right but you couldn't tell as you had the Office oval error.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now