473,769 Members | 6,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel Automation - Find/Replace

This excel find/replace code works great under Excel 2003 but bombs with an
error (pasted below the code) in Excel 2000. Can anyone suggest an
alternative to make both happy? I am using vb.net windows application. I
also tried creating an object and assigning the find/replace event to it but
I also received errors.

I am a little under the gun on this one....

WSheet.Applicat ion.Selection.R eplace(What:="N ONE", Replacement:="" ,
LookAt:=1, _
SearchOrder:=1, MatchCase:=Fals e, SearchFormat:=F alse, _
ReplaceFormat:= False)

WSheet.Applicat ion.Selection.R eplace.Replace( What:="PRODUCTG ROUP",
Replacement:="G ROUP", LookAt:=1, _
SearchOrder:=1, MatchCase:=Fals e,
SearchFormat:=F alse, _
ReplaceFormat:= False)

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime. InteropServices .COMException (0x800A03EC): Exception from
HRESULT: 0x800A03EC.
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifi er[] modifiers,
CultureInfo culture, String[] namedParameters )
at Microsoft.Visua lBasic.Compiler Services.VBBind er.InvokeMember (String
name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object
target, Object[] args, ParameterModifi er[] modifiers, CultureInfo culture,
String[] namedParameters )
at
Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn)
at Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateCall( Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
at Unlock_Orders.F orm3.GetAllItem sSpecifiedLists ()
at Unlock_Orders.F orm3.Button4_Cl ick(Object sender, EventArgs e)
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Nov 20 '05 #1
2 10011
Hi Scorp,

Is that (double replace)
WSheet.Applicat ion.Selection.R eplace.Replace( What:="PRODUCTG ROUP", a typo or is it really in your code? Could 2003 have compensated for it
but not 2000?

HTH,

Bernie

"scorpion53 061" <Its the end of the world as we know it@here.com> wrote in
message news:e0******** ******@TK2MSFTN GP12.phx.gbl... This excel find/replace code works great under Excel 2003 but bombs with an error (pasted below the code) in Excel 2000. Can anyone suggest an
alternative to make both happy? I am using vb.net windows application. I
also tried creating an object and assigning the find/replace event to it but I also received errors.

I am a little under the gun on this one....

WSheet.Applicat ion.Selection.R eplace(What:="N ONE", Replacement:="" ,
LookAt:=1, _
SearchOrder:=1, MatchCase:=Fals e, SearchFormat:=F alse, _
ReplaceFormat:= False)

WSheet.Applicat ion.Selection.R eplace.Replace( What:="PRODUCTG ROUP",
Replacement:="G ROUP", LookAt:=1, _
SearchOrder:=1, MatchCase:=Fals e,
SearchFormat:=F alse, _
ReplaceFormat:= False)

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime. InteropServices .COMException (0x800A03EC): Exception from
HRESULT: 0x800A03EC.
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifi er[] modifiers, CultureInfo culture, String[] namedParameters )
at Microsoft.Visua lBasic.Compiler Services.VBBind er.InvokeMember (String
name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object
target, Object[] args, ParameterModifi er[] modifiers, CultureInfo culture,
String[] namedParameters )
at
Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateCall( Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
at Unlock_Orders.F orm3.GetAllItem sSpecifiedLists ()
at Unlock_Orders.F orm3.Button4_Cl ick(Object sender, EventArgs e)
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Nov 20 '05 #2
> Is that (double replace)
WSheet.Applicat ion.Selection.R eplace.Replace


yep typo......

sorry :(
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
17418
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed a database for her which is intended to make things a lot easier; however, I don't have a lot of experience with Access and I find that designing the reports in Access is tedious. I want to be able to print the reports (which are simply based on...
6
14560
by: Frank X | last post by:
Excel 2002 introduced a capability to add custom worksheet functions to Excel direct from a COM/ActiveX object. I can use C# to develop a COM object which I can use fine from Excel/VBA, however I can't see it using the Excel Tools/Add-Ins - Automation button. Now this appears to be because it is not an *ActiveX* COM object, apparently in order to be an ActiveX object the COM object needs to have a 'CLSID'/Programmable key entry in the...
17
6348
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
12
2434
by: D. Shane Fowlkes | last post by:
This most likely belongs in another forum but I thought I'd start here. I have a COM Object written in VB6. The DLL will access MS Excel and use it's Object Library to write a customized report and saves it to a folder. The DLL even writes to a log for each step it takes so we can troubleshoot the problems (if any). This works fine on one machine but not another. The folder the DLL is trying to write to has full permissions assigned...
6
598
by: a.theil | last post by:
Please help! I need a simple excel automation, just 2 write some files into excel. I do: Dim oXL As Excel.Application Dim oWB As Excel.Workbook Dim oSheet As Excel.Worksheet Dim oRng As Excel.Range
3
5068
by: Tim Marsden | last post by:
Hi, I am currently creating an instance of Excel using VB.NET Automation. dim xl as Excel.Application xl = new Excel.Application However, how can I have more control over the starting of Excel. For example I want to specify command line switches, or prevent certain ComAdd-ins from loading when I start Excel.
3
5523
by: Maxwell2006 | last post by:
Hi, We have Excel 2003 templates and we need to automatically generate excel 2003 xls files based on our SQL server database tables' data. Since we need to generate the xls files at out asp.net server side, I assume we cannot use excel automation based on the license agreement. What would b the best way to do that? Any help would be appreciated,
3
3252
by: saragoesnuts | last post by:
I have a program that automates to Excel with information in tables. I want to add charts to the excel file (pie charts, bar charts, etc). Is this possible?
4
3984
by: =?Utf-8?B?THluZXJz?= | last post by:
Hello All, We have a VB.NET application writen using VS 2003. This application apens an excel file from a vendor, reads the data and performs whatever functions it needs. We recently upgraded our sytems to Excel 2003 from Excel 2000. Our application started erroring out because it was having a problem with opening the Excel file. From troubleshooting, the exact problem is in Excel 2003, it does not like the sheet name (even though the...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.