Apr 11th, 2006, 07:22 AM
#1
Thread Starter
Frenzied Member
Excel being weird !
I've got the following code, which basically adds sheets on the fly as and when required. it puts the new sheet at the end and gives it a unique name.
Problem I have is that it works on some machines and not others.
Same version of the EXE, all the right DLL's installed etc etc, but only works on some and not all
VB Code:
Do While Not rs.EOF
.ActiveCell.Value = rs!CON_LOCN
.ActiveCell.Offset(0, 1).Value = RTrim(rs!CON_COMP)
.ActiveCell.Offset(0, 2).Value = RTrim(rs!CON_ELEM)
.ActiveCell.Offset(0, 3).Value = RTrim(rs!CON_COND)
.ActiveCell.Offset(0, 4).Value = RTrim(rs!CON_REMW)
.ActiveCell.Offset(0, 5).Value = RTrim(rs!CON_QUAN)
.ActiveCell.Offset(0, 6).Value = RTrim(rs!CON_PRIO)
.ActiveCell.Offset(0, 7).Value = RTrim(rs!CON_BUDG)
.ActiveCell.Offset(0, 8).Value = RTrim(rs!CON_COMM)
.ActiveCell.Offset(1, 0).Select
RowCount = RowCount + 1 ' £££
If RowCount > 18 Then
ConditionPageNo = ConditionPageNo + 1
' Create new Page
[B]objExcel.Sheets(objExcel.ActiveSheet.Name).Copy After:=objExcel.Sheets(objExcel.Sheets.Count)
.ActiveSheet.Name = "Condition Data-Details" & ConditionPageNo[/B]
' Blank out contents
.Range("A8:N61").Select
.Selection.ClearContents
.Range("A8").Select
' Reset row counter
RowCount = 1
End If
rs.MoveNext
Loop
I've highlighted the offending bit.
On the machines it doesn't work on I get the error below.
Any help would be greatly appreciated.
Steve.
Attached Images
Apr 11th, 2006, 11:44 AM
#2
Re: Excel being weird !
Looks like your not renaming it to a unique name.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Apr 12th, 2006, 02:32 AM
#3
Thread Starter
Frenzied Member
Re: Excel being weird !
Well yes I would draw that conclusion too, were it not for the fact that it works perfectly well on my pc.
Surely if that were the issue I would have this problem everywhere wouldn't I ?!
Apr 12th, 2006, 10:51 AM
#4
Re: Excel being weird !
On the ones where it doesnt work what are the versions of Excel installed?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Apr 12th, 2006, 11:01 AM
#5
Thread Starter
Frenzied Member
Re: Excel being weird !
they are the same as mine .. Excel 2000. There may or may not be a difference in service pack levels, but thats all I could imaging it could be.
We are all on Windows XP as well, although I wouldn't have thought that would have had a bearing on it.
Apr 12th, 2006, 11:23 AM
#6
Re: Excel being weird !
How about not using the ActiveSheet object as if the user accidentally sets another sheet active it will throw off your naming convection?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Apr 12th, 2006, 01:31 PM
#7
Re: Excel being weird !
I don't find any errors on your code!
Apr 13th, 2006, 02:24 AM
#8
Thread Starter
Frenzied Member
Re: Excel being weird !
Rob ... they don't get the chance ... its all runnign background, they don't even see it.
cssriraman ... neither do I, but I must be missing something.
I strongly suspect its a difference in Excel versions, because otherwise it wouldn't work for me either.
I thought maybe running it from development mode rather than an exe might have caused a difference somehow, so I compiled it and used the same EXE on my machine and a problem machine .... and got the same results ... worked perfectly for me, and not for them.
I checked for rogue Excel processes, but I'm clearing those down properly too, so I'm really stumped. I hate these kind of problems. I would rather it was just a coding issue.
Apr 14th, 2006, 12:14 PM
#9
Re: Excel being weird !
What about any service packs for Office/Excel? Are they all on the same SP too?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Apr 15th, 2006, 06:36 AM
#10
Frenzied Member
Re: Excel being weird !
Show us more of your code ... there is a "With" statement somewhere previous to the code you've shown. I'm wondering about your ".ActiveSheet" statement ... especially the "." prefix.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Apr 18th, 2006, 02:07 AM
#11
Thread Starter
Frenzied Member
Re: Excel being weird !
Attached Files
Apr 18th, 2006, 08:51 AM
#12
Frenzied Member
Re: Excel being weird !
And what are you writing this in ... Access ... VB6 ... .Net ... ???
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Apr 18th, 2006, 08:52 AM
#13
Thread Starter
Frenzied Member
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width