Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rename Excel Sheets
Message
 
 
To
06/04/2007 12:44:48
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01213003
Message ID:
01213018
Views:
15
This message has been marked as the solution to the initial question of the thread.
Are you sure that you have unique path1 field in your result? And that it contains just simple letters and numbers?

Also I just figured that you're doing wrong in the code. You're assigning different names in the loop to the same sheet, then repeat the same process with different number.

See the changes I made.
select path1;
>	from cheqs;
>	where bank= (thisform.pageframe1.page5.text6.value);
>	and branch= alltrim(thisform.pageframe1.page5.text3.value);
>	into cursor acc2
lnI = 0
lnMax =  oexcel.activeworkbook.sheets.count
>	select acc2
>	scan
>		pa=path1
                   lnI = m.lnI + 1 
                   if m.lnI > m.lnMax
                        exit
                    endif
>		 oexcel.Sheets(m.lnI).Name = juststem(pa)
>		endscan
>Dear Experts
>
>select path1;
>	from cheqs;
>	where bank= (thisform.pageframe1.page5.text6.value);
>	and branch= alltrim(thisform.pageframe1.page5.text3.value);
>	into cursor acc2
>
>for x=1 to oexcel.activeworkbook.sheets.count
>	select acc2
>	scan
>		pa=path1
>		 oexcel.Sheets(x).Name = juststem(pa)
>		endscan
>endfor
>
>The above procedure shows following error message
>OLE IDispatch exception code 0 from Microsfot Office Excel:
>Cannot rename a sheet to the same name as another sheet, a referenced object library or a workbook referenced by Visual Basic ....
>
>Please help
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform