Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel automation in FoxPro 7

Status
Not open for further replies.

igorsandler

Programmer
Feb 22, 2024
17
US
Hello,
I have a situation when I need to format Excel file column(file created programmatically with Excel object) that contains Social Security numbers to be right justified. The problem I have is with SSN with leading zero(s). They are coming out left justified.

Ideally I would like to programmatically format Column as General or Text and set it to have right alignment. I tried to use:

oSheet.RANGE["D","D"].EntireColumn.NumberFormat = "General"
oSheet.COLUMNS("D").EntireColumn.AutoFit

Getting an error on the first line, due to incorrect reference or syntax.

Any help would be appreciated.

Also, is there a decent manual or book or whatever on how to use Excel automation with FoxPro 7?

Igor
 
Try recording a macro in Excel doing what you want to do, and look at the code to see one right syntax. Off the top of my head, you probably need to eliminate "EntireColumn." from that code.

The book Della Martin and I wrote on automating Office should work for you, though of course, all the Office apps have lots more functionality since then: It's not available in print anymore, but you can buy and download the ebook.

I've also written some articles that might help you get started, but they're not in depth. You'll find my papers at use the Categories filter to select "Microsoft Office." (Full disclosure: Della wrote the Excel chapters, so my papers tend to focus more on Word.")

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top