473,757 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Has anyone ever used the 4Tops Excel Import Assistant Add-In from Code?

the title is self explanatory. However although I have figured out how
to implement the add-in from code, it consistently fails with the
message. "There is no active worksheet". I tried opening Excel to the
worksheet I want to import and then running the code but it didn't work.
I have posted the code in case anyone can spot my error.

---Code Start----
33230 On Error GoTo CmdOK_Click_Err or
33240 IntImportValue = Forms!frmImport Contacts.FrmeIm portChoice.Valu e
33250 If IsEmpty(IntImpo rtValue) Then
33260 Exit Sub
33270 Else
33280 Select Case IntImportValue
Case 1 'Import
Dim VUIObjectName As String
Dim VUIObjectType As Long
Dim SessionName As String
Dim Wbks As String
Dim SkipDuplicates As Boolean
Dim TruncateLongVal ues As Boolean
Dim ImportAllSheets As Boolean
Dim RunUnattended As Boolean
Dim CreateLogWorkbo oks As Boolean
Dim CloseXlImportFo rm As Boolean
Dim LogDir As String
Dim OpenLogWorkbook s As Boolean
Dim SessionName2Sav e As String
Dim CloseVUIObject As Boolean
Dim FolderToMoveWbk To As String
Dim fRet As Boolean

VUIObjectName = "Contacts"
VUIObjectType = acTable
SessionName = "ContactImp ort"
Wbks = "F:\Centre Stuff\Show Contacts
Database\Develo pment\MedtradeC ontacts2003.xls "
SkipDuplicates = True
TruncateLongVal ues = False
ImportAllSheets = False
RunUnattended = False
CloseXlImportFo rm = True
CreateLogWorkbo oks = False
LogDir = ""
OpenLogWorkbook s = False
SessionName2Sav e = "ContactImport( TABLE)"
CloseVUIObject = True

fRet = ftExcelImport( _
VUIObjectName, VUIObjectType, SessionName, _
Wbks, SkipDuplicates, TruncateLongVal ues, _
ImportAllSheets , RunUnattended, CreateLogWorkbo oks, _
CloseXlImportFo rm, LogDir, OpenLogWorkbook s, _
SessionName2Sav e, CloseVUIObject, FolderToMoveWbk To _
)

'(c) 4TOPS 2002-2003
If fRet = True Then
FormattedMsgBox "Congratulation s! @The contacts were
imported successfully!@" , vbInformation + vbOKOnly, "Success"
DoCmd.Close acForm, frmImportContac ts
Else:
FormattedMsgBox "The Import was not successful.@Ple ase talk
to your database administrator.@ ", vbInformation + vbOKOnly, "Failure!"
DoCmd.Close acForm, frmImportContac ts
End If
33550 Case 2 'Enter Manually
33560
33570 End Select
33580 End If

33590 On Error GoTo 33230
33600 Exit Sub

CmdOK_Click_Err or:
Dim ErrorNumber As Variant
Dim response As Integer
33610 Select Case ErrorNumber
Case 2501
33620 FormattedMsgBox "Error" & Err.Number + Err.Description &
"has occurred in procedure" & Err.Source & ".@ Please talk to your
database administrator.@ ", vbOKOnly + vbCritical, "Error!"
Case 2484
FormattedMsgBox "Error" & Err.Number + Err.Description &
"has occurred in procedure" & Err.Source & ".@ Please talk to your
database administrator.@ ", vbOKOnly + vbCritical, "Error!"
33630 End Select
End Sub

---Code End---


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
0 1307

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

Similar topics

4
4704
by: Little PussyCat | last post by:
Hello, I nee to write something that will transfer excel data into an SQL Server table. I have for another database application I wrote have it importing Excel spreadsheet data using cell by cell, row by row method. This is fully automated so the user can choose whatever spreadsheet they want to import and press a button which sits on a VB6 frontend. This has been good for that situsation but it can be very slow when there
0
1197
by: Eugfene | last post by:
Hi I was trying to import an excel document into the excel file using the Import and Export Data wizard of MS SQL Server 2000 but when I do that, I seemed to get countless of rows with NULL values on every attribute. Furthermore i could not delete the NULL rows on the Enterprise Manager. May i know how to solve this problem? Thanks Eugene
1
3214
by: Richard Holliingsworth | last post by:
Hello: Thanks for your quick response. I'm trying to import a new Excel file into an A2K table and it's truncating the data. One of the Excel columns is a text field that can be up to 2000 characters. When I import it into A2K, that field is truncated. If I try to inport the file into an EXISTING table that I define myself where that field is a MEMO field, the import crashes.
8
2860
by: DC Gringo | last post by:
I have a simple button that should open another window and export a datagrid to an Excel file. I'm getting: "Name 'window' is not declared." What do I need to declare or import? <INPUT ID="Button5" ONCLICK="Button5_Click" NAME="Button5" TYPE="button" VALUE="Export to Excel"> Sub Button5_Click()
3
3274
by: Kbalz | last post by:
Hello, I'm trying to create an application for a friend's business. He gets Excel Spreadsheets from a lab - he would like for his partners to be able to Upload this Sheet to a website, and have the page import the sheet and add the data to his existing SS 2005 database. Is this possible, and where should I begin looking? Thanks,
2
9294
by: Ray | last post by:
Hi, I need to use cell's background color. when I record a macro from excel, it shows: Rows("7:7").Select With Selection.Interior .ColorIndex = 8 .Pattern = xlSolid
1
3006
by: Haidee | last post by:
Hi I'm pretty new to MS Access so please be patient.... I have a user that is trying to import an external excel spreadsheet into MS access 2003 by using the File - Get external data - Import. She is also running Access 97 and it works fine into that. The error she gets is: You have encountered an error and MS office access needs to close.We are sorry for any inconvenience.The information you were working on might be lost. MS...
3
5327
by: D.Stone | last post by:
I'm trying to import an Excel spreadsheet into an existing Access table using Office 2003. Ultimately, the plan is to do it programmatically using TransferSpreadsheet, but to check that the file has no problems, I've done it manually with the Import Spreadsheet wizard. The worksheet has 43 rows, and I import a named range defined as "=Sheet1!$C:$E". The import works, but I get a table with 64K rows, all but 43 being blank!
3
3614
by: MarcGA | last post by:
(Excel 2003, Access 2003, XP, novice user here) I can't get Access to accept multiple Excel files to the same table. I can import the spreadsheets to a new table, but I need to import 23 spreadsheets to the same table. I'm not getting a formatting error, just a "file did not import" message. Also, when I do import one-to-one, Access inserts thousands of blank lines before the first line of imported data. How do I keep Access from doing...
4
2773
by: alvinstraight38 | last post by:
Hey guys, I am trying to import data from an Excel spreadsheet into my SQL database. I am running SQL 2005. I following Microsoft's instructions for creating a linked server, and it appeared to work. However when I run this query: SELECT * INTO test FROM OPENQUERY(EFORMS, 'SELECT * FROM ')
0
9487
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...
1
9884
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,...
1
7285
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
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
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
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
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
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.