vba

How to use sqlite database from inside MS Access ?

I would like to use a sqlite databse inside MS Access in order to use (transfer would be good enough) the content of sqlite database table in MS-Access. How can this be done in VBA ? EDIT: This "Application" is for a client and I can not make him install "extra software" than the one already installed (in this case MS-Access): Does...

Getting around the Max String size in a vba function?

The max number of characters you can use in string in a vba function is 255. I am trying to run this function Var1= 1 Var2= 2 . . . Var256 =256 RunMacros= "'Tims_pet_Robot """ & Var1 & """ , """ & Var2 & """ , """ ... """ & Var256 """ '" Runat=TimeValue("15:00:00") Application.OnTime EarliestTime:=Runat, Procedure:=RunMacros & RunMa...

VBA Worsheet.OnActivate

Hi, I have a method in my VBA code that needs to be assigned to a workbook How can I assign this method to the worksheet.OnActivate event using VBA code? I tried: sht.Onactivate = "Sheet_Activate" But this doesn't work and I need something on these lines. Thanks. ...

Daylight Savings Handling in DateDiff() in MS Access?

I am fully aware of DateDiff()'s inability to handle daylight savings issues. Since I often use it to compare the number of hours or days between 2 datetimes several months apart, I need to write up a solution to handle DST. This is what I came up with, a function that first subtracts 60 minutes from a datetime value if it falls within ...

MS Access 2003 : VBA for INSERT INTO statement, new record: how to grab autoid number created?

I have a button click event that takes information from controls and enters it into a table via INSERT INTO SQL statement in VBA. I was wondering if there is anything I could add to this, or some other method to acquire the record number that is created for the record? Could I just turn around and SELECT against the table and use rs.la...

VBA IDE Color Scheme Add-In

Does anyone know of a VBA add-in that would provide more options for the IDE color scheme? It's pretty limited. Thanks for the help. ...

getting html source with excel-vba?

i would like to direct an excel VBA form to certain URL's and get the html source and put it in a string. is this possisble? ...

Getting "[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'Microsoft.'

Hi Experts, I'm getting an error, "[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'Microsoft.' Here is the code: Dim conn As ADODB.Connection Dim rst As ADODB.Recordset Dim stSQL As String Public Sub loadData() 'This was set up using Microsoft ActiveX Data Components version 6.0. 'Create ADODB connectio...

Save text file UTF-8 encoded with VBA

Hello, how can I write UTF-8 encoded strings to a textfile from vba, like Dim fnum As Integer fnum = FreeFile Open "myfile.txt" For Output As fnum Print #fnum, "special characters: äöüß" 'latin-1 or something by default Close fnum Is there some setting on Application level? ...

Automation Error upon running VBA script in Excel

Hi guys, I'm getting an Automation error upon running VBA code in Excel 2007. I'm attempting to connect to a remote SQL Server DB and load data to from Excel to SQL Server. The error I get is, "Run-time error '-2147217843(80040e4d)': Automation error". I checked out the MSDN site and it suggested that this may be due to a bug assoc...

ACCESS 2003 Excel 2003 : VBA for opening Excel file from Access and copying a pictre from excel then returning it to Access form

So I have an excel workbook that has a nice global map of shaperange objects. With some very simple code I can change the colors, group and ungroup collections of countries into arrays, etc...and it works pretty well. However, I would like to bring this into Access. So I could copy and paste all the shapes into an access form manually, ...

MS Access 2003 - Is there a way to run access (mde) without the access shell around the forms/reports

So I am not sure if I am asking this correctly; let me explain: IS there a way I can run my MDE without the access shell around the forms/reports? The part that provides the menu, and the little application title. I think it is the overall presentation layer form that all my access stuff sits on, but I am not sure. I am just wondering i...

Function returning a class containing a function returning a class

I'm working on an object-oriented Excel add-in to retrieve information from our ERP system's database. Here is an example of a function call: itemDescription = Macola.Item("12345").Description Macola is an instance of a class which takes care of database access. Item() is a function of the Macola class which returns an instance of an I...

Running a simple VBA script to test a connection

I'm trying to test the connection of a GoDaddy SQL Server database. I'm getting an 'invalid connection string attribute.' What's wrong with this script? Dim cnn As ADODB.Connection Dim canConnect As Boolean Public Sub TestConnection() Set cnn = New ADODB.Connection cnn.Open "Provider=sqloledb;Data Source=GoDaddyServer.com...

VBA Outlook Mail .display, recording when/if sent manually

My code displays a message with basic subject, body, attachment. Next the user manually updates and customizes the message and should send it. I want to record when (if) the email is sent. Is this possible or any tips? My environment is Office 2007 with an excel based macro going to Outlook. [Excerpt] Dim OutApp As Outlook.Applicat...

Access VBA remove CR & LF only from the beginning of a text string by searching for them

Hi there I need to remove line breaks from the beginning of a memo type records. I dont want to use the replace function as it would remove all line breaks from the record which is not desired. Its only the line breaks at the beginning of the field that I am interested in removing. Furthermore, the my records do not always begin with a...

Excel Macro to create sheets

I have a Excel sheet with two columns and I need to create new sheets based on the values of the first column.ie A B test1 Value21 test1 Values22 test2 Value21 test2 Value32 test3 Values32 IN this case I need to create three sheets namely test1,test2 and test3 Sheet 1 should contain test1 field and its correspon...

Can't change pivot table's Access data source - bug in Excel 2000 SP3?

I have a set of Excel 2000 SP3 worksheets that have Pivot Tables that get data from an Access 2000 SP3 database created by a contractor who left our company. Unfortunately, he did all his work on his private area on the company (Novell) network and now that he has left us, the drive spec has been deleted and is invalid. We were able to ...

Inconsistency in passing objects from VBA to .NET via COM

I have the following interface defined to expose a .NET class to COM: [InterfaceType(ComInterfaceType.InterfaceIsDual)] [Guid("6A983BCC-5C83-4b30-8400-690763939659")] [ComVisible(true)] public interface IComClass { object Value { get; set; } object GetValue(); void SetValue(object value); } The implementation of this int...

Whats the difference between rs.close vs rs = nothing in a RecordSet

I often find it confusing as to when it is appropriate to use: rs.Close opposed to Set rs = Nothing I can understand needing to close a connection to a source, but should I be using both when the variable falls out of scope? Can I just set the variable to Nothing in order to skip the step of Closing the connection? Would this ...