How to rotate text in cells in MS Access 2000 by VBA which call from VB6.0

lhquah
lhquah used Ask the Experts™
on
I am building an Excel spreadsheet from VB and would like to rotate the text in selected cells to 45 degrees using VBA code.  How can I do this? I have looked at the WordArt and Shape object but could not make sense of them.
Below is my sample code,

In VBA, i hv a module RotateCell :
Public Sub RotateCell()
 Sheet1.Range("A1").Select
 Sheet1.Range(ActiveCell, ActiveCell.End(xlToRight)).Orientation = 45
End Sub

In VB, i call RotateCell :
Private Sub CallRotateCell()
Set objExAP = CreateObject("Excel.Application")
  objExAP.Workbooks.Open "C:\Test.xls"
  objExAP.Run "RotateCell"
  objExAP.Workbooks.Close
End Sub

The selected text are not rotate when i run the aplication. If i change the orientation value to 90 or -90, then the selected text will rotate.

Any idea?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The orientation property will only accept degree increments of 90.

Author

Commented:
thanks twalgrave.

now i change my code, which i use wordart for text rotation instead of rotate the text in cell.

But i encountered that if i save the file as xlExcel4Workbook file format, the wordart appear in the file as a rectangle object.

if i didnt specify the file format to save (which it use the defaulted file format), then the wordart will appear, but the macro will in the saved xls file too...

Do you hv any idea wat file format should i use for file saving to make the wordart appear? or how to delete macro from the saved file (if defaulted file format are using)?

Here are the syntax that im using for saving the file:

Application.ActiveWorkbook.SaveAs "c:\MyFile.xls", xlExcel4Workbook

Thanks!

If I recall correctly, MS seriously revamped the wordart capabilities from V4 to V7. This is probably why you cannot save that wordart.  You should save the file as the current format.  Unfortunately, I don't know what to do about the code going with.  It must go with if you want the text to be rotated.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
tq for the response.
i now save the file in the defaulted file format in order to get the wordart. and use the following code to delete all the macro... Thanks

Author

Commented:
the code are as below....

Dim objVBComp   As VBIDE.VBComponent
Dim objVBComps  As VBIDE.VBComponents
   
    Set objVBComps = ThisWorkbook.VBProject.VBComponents

    For Each objVBComp In objVBComps
        If objVBComp.Type = vbext_ct_StdModule Then _ objVBComps.Remove objVBComp
    Next objVBComp

and everything are now working fine..... Thanks
Cool.  

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial