Link to home
Start Free TrialLog in
Avatar of Richard
RichardFlag for United States of America

asked on

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?
SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richard

ASKER

Thanks, is there a list of all the constants for the msoShapeTypes somewhere?
Avatar of RogueSolutions
RogueSolutions


Add a reference to Microsoft Office 9.0 (or 10.0, whatever you have) and you should find the constants become available to you.
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
Avatar of Richard

ASKER

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?
>>Now I can't restore the ADODB referance<<

What's the error?

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?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richard

ASKER

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.

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.