I have a Microsoft Word template with some code and some references, that has been working fine for months but has just started throwing up a spurious "User-defined type not defined" error whenever I open it or try to compile it.
I know it's a spurious error because I haven't made any significant changes to the code. In fact, I've rolle...
Does anyone know how I can have a macro load on document load when opening a PowerPoint pot-template? I've looked at some Auto_Open and add-ins which looks like need to be set.
But there's a few settings that need to be set as well within PowerPoint itself for it to work. I've got a template which thousands of users are about to be usin...
I am creating a Crosstab query at runtime with the option of using a summary type of "SUM" or "COUNT". If I set Sum, then I want an output format of "$#,##0.00", and if it is Count, then I want an output format of "#,##0". There are lots of discussion questions setting a tableDef Field property to format output, but there is nothing th...
I have a VBA function that initializes a lotus notes session, creates a document and mails it. It also accepts as an optional parameter a NotesRichTextItem which I append to the body of the email.
However, I am getting the error message "All objects must be from the same session". How do I 'import' this NotesRichTextItem into my sessi...
I can't seem to find the documentation explaining how to create a hash table or associative array in VBA. Is it even possible?
Can you link to an article or better yet post the code?
Thanks!!!
...
Hello all I am getting an error
Run-time error '9':
Subscript out of range
with the following code
Public newarray() As String
Sub test1()
Dim int1 As Integer
int1 = 0
Do
int1 = int1 + 1
newarray(int1) = int1 * 5
Loop Until int1 > 3
End Sub
when i decare the array
Public newarray(4) As s...
All,
I'm trying to use vlookup in a simple VBA function, but it is continually returning #VALUE!
Here is the code:
Public Function getAreaName(UBR As Integer) As String
Dim result As String
Dim sheet As Worksheet
Set sheet = ActiveWorkbook.Sheets("UBR Report")
' check level 3 then 2 then 4 then 5
result = Application.Worksh...
About a year ago, a manager in another department brainstormed that I could code up some VBA to auto call me in the event one of my automated reports crashes. I laughed at the time, but my skills have improved considerably and I wonder if it's technically possible
(not that I'd actually do it, mind you. I like my early Saturday morning...
Given: I recorded a simple macro in Openoffice to save my worksheet as a CSV file. Here it is.
sub toCSV
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).N...
I have two databases on the same server with the same name and different port number. The tnxnames.ora entry looks like (actually one database is a clone of the other one.)
AAAA.FSA.GOV.UK =
(DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = SERVERNAME)(Port = 1530)))
(CONNECT_DATA = (SID = AAAA)))
AAAA.FSA.GOV.UK =
(DE...
Is it possible to control the Tools->Options->View->"View Whitespace between pages" through VBA/Macros?
Thanks.
...
I have to refresh link tables in a MDB file. However MS Access in not installed in the server where the MDB file resides.
I have copied the same MDB file into the local machine and try to refresh the link tables.
Now it is asking for DSN name.
Now I created a new DSN, in the same name what is there in the link table descriptions.
But...
I have a folder full of 100-odd Access97 files. I need to update them all to Access2003.
I could do it manually, but using VBA would probably be a lot faster.
Does anyone that would have a snippet that would do this? Or an alternative suggestion?
...
If I have a main procedure with error handling that calls other procedures without error handling, should errors roll up to the main procedure?
What if the procedures without error handling use functions without error handling?
Should everything roll up to the main procedure's error handling?
I apologize ahead of time if this is a s...
I am porting Excel VBA to VB.NET. I have a function that takes a selection of data, and it may be one dimensional or two. VBA code is quite fluid about using a variable as either a 1-D or 2-D array, but VB.NET marks it as an error.
Here is the reduced code:
Public Function Stat(ByVal Data As Range) As Object
Dim Y() As Object
D...
Which is the most efficient way to do this?
Sub pvaSetWeek(Optional weekOffset As Long = 0)
Dim theDayToday As Long
theDayToday = Weekday(Now, vbMonday)
'Set start to Monday
Range("pvaStartDate") = Int(Now) - (theDayToday - 1) - (weekOffset * 7)
'Set end to Sunday
Range("pvaEndDate") = Int(Now) + (7 - theDayTo...
Hello, I have created a macro for excel which will pop up form that contains button and text field. Is there a way to assign hotkeys such as 'ctrl+Enter' or 'F12' to the buttons? The hotkey should work regardless of which field or button the focus is on.
(so far I have managed to create buttons/fields_Keydowns to check MSForms.ReturnIn...
I have problem in the following code :
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
stSql = "SELECT * FROM [SB Items] "
stSql = stSql & "WHERE [SBID]=" & Me![SBID] & " AND [ItemNumber]=" & intBtn
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
' If no item matches, report the ...
how can one create a password on a visual basic access database when you have a vb datagrid
...
We have a web-service within an existing ASP.NET website which works fine when accessed via other ASP.NET bits. I'd like to get Excel 2007 and 2003 to call the w-s and refresh part of a worksheet with the results using VBA.
Ideally I'd like a vanilla version of Excel to be able to do this (ie without the client having to install extra b...