473,507 Members | 2,460 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_Error
33240 IntImportValue = Forms!frmImportContacts.FrmeImportChoice.Value
33250 If IsEmpty(IntImportValue) 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 TruncateLongValues As Boolean
Dim ImportAllSheets As Boolean
Dim RunUnattended As Boolean
Dim CreateLogWorkbooks As Boolean
Dim CloseXlImportForm As Boolean
Dim LogDir As String
Dim OpenLogWorkbooks As Boolean
Dim SessionName2Save As String
Dim CloseVUIObject As Boolean
Dim FolderToMoveWbkTo As String
Dim fRet As Boolean

VUIObjectName = "Contacts"
VUIObjectType = acTable
SessionName = "ContactImport"
Wbks = "F:\Centre Stuff\Show Contacts
Database\Development\MedtradeContacts2003.xls"
SkipDuplicates = True
TruncateLongValues = False
ImportAllSheets = False
RunUnattended = False
CloseXlImportForm = True
CreateLogWorkbooks = False
LogDir = ""
OpenLogWorkbooks = False
SessionName2Save = "ContactImport(TABLE)"
CloseVUIObject = True

fRet = ftExcelImport( _
VUIObjectName, VUIObjectType, SessionName, _
Wbks, SkipDuplicates, TruncateLongValues, _
ImportAllSheets, RunUnattended, CreateLogWorkbooks, _
CloseXlImportForm, LogDir, OpenLogWorkbooks, _
SessionName2Save, CloseVUIObject, FolderToMoveWbkTo _
)

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

33590 On Error GoTo 33230
33600 Exit Sub

CmdOK_Click_Error:
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 1283

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

Similar topics

4
4675
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...
0
1185
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...
1
3172
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...
8
2829
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...
3
3263
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...
2
9142
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
2981
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. ...
3
5305
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...
3
3593
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...
4
2755
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...
0
7223
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,...
0
7110
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...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7030
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...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
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...
0
4702
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...
0
1540
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 ...
0
411
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...

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.