vba

MS Access 2003 - VBA for getting user name from LAN sign on

Is there a way to set up a function that will get the user name of the user's LAN sign on, to use for the =(getusername) within Access? Is there some general vb that will work for this idea? thanks! ...

Is there a DocumentAfterPrint event in MS Word?

I am working on a project where I need to return a word document back to a certain state after it is printed. I have found a DocumentBeforePrint event but I cannot find a DocumentAfterPrint event. Is it poorly documented or is there some other workaround that exists? ...

How to show the start date for an INSTANCE of a recurring Series?

Using VBA, I need to show the start date of each INSTANCE of a recurring appointment in Outlook. The problem is that when I use appt.start it shows the start date of the SERIES, which is not helpful!! Example: a recurring appointment happens on the first of every month in 2009. I want to show 12 INSTANCES, with 12 DIFFERENT start dates...

Copy Excel worksheets, macros, and graphs from one workbook to another, moving links to the new workbook

I have an Excel workbook with a number of features: One main user-facing sheet One summary sheet based on the user-facing sheet's data A number of graphs based on the user-facing sheet's data (as in, the type of graphs with a separate tab for them, rather than objects within a worksheet - I'm not sure if they have a special name or spe...

VBA changes Excel 2002 -> Excel 2007

Where can I find a complete list of changes in VBA from Excel XP (2002) to Excel 2007? I have a workbook that relies heavily on VBA which I have been working on in 2002, and when I opened it in 2007, I noticed that some things had changed. For instance, my workbook does lots of 3d rotation; I discovered that Shape.ThreeD.RotationX has ...

First week date to be added in VBA

Hi , I need to add automatically current weeks first date into a table and a text box of a vba form. could anyone help if any functions are available ?? ...

Display selection at upper left corner of spreadsheet

hi is it possible to do this kind of things in excel-2007 vb... for example user selects cell or range.... let's say cell G13, now this cell will be displayed on the upper-left corner of the sheet (i.e. where usually A1 resides by default) in the case of range selection the upper-left corner of the range will be displayed in upper-left ...

"Null" value in Queries

I'm trying to run code that will copy fields into a new table, moving them from a _New table to the original table. The VBA code that does this works as such: SQLStatement = CStr("INSERT INTO " & TName & " SELECT * FROM " & TName & "_New") Log.WriteLine "Running query with string """ & SQLStatement & """ " QueryTimer = Timer DoCmd.RunS...

In C#, how do you convert the TimeSpan datatype to DateTime?

I'm converting a small MSAccess application to a web-based ASP.NET app, using C# 3.5. I was wondering what's the best way to work with dates in C#, when converting some of this VBA code over to C#. Here is an example of the VBA Code: Coverage1=IIf(IsNull([EffDate1]),0,IIf([CurrDate]<=[EndDate1],[CurrDate]-[EffDate1],[EndDate1]-[EffDat...

Word VBA Tabstop Problem

Hello, I have the following VBA code Private Sub CreateQuery_Click() Dim doc As Document Dim i As Integer Set doc = ActiveDocument i = doc.Paragraphs.Count doc.Paragraphs(i).Range.InsertParagraphAfter i = i + 1 For j = 0 To 1000 doc.Paragraphs(i).Range.InsertParagraphAfter i = i + 1 doc.Paragraphs(i)...

VBA editor auto-deletes spaces at the ends of lines

Is there a way to convince the VBA editor in Excel to stop auto-formatting lines to remove the space at the end when I pause in my typing for a quarter second? ...

With VBA, how can I check if, in Windows Explorer, the file extensions for known file types are hidden?

Without opening Windows Explorer. I want to check for this from Word VBA. Thanks. EDIT: This code works now: Set WshShell = CreateObject("WScript.Shell") If WshShell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt") = 0 Then MsgBox Prompt:="In Windows Explorer, set the folder op...

vba sql problem

Below query is showing error Please help : DoCmd.RunSQL ("insert into tbltesting (IsDiff)values ('Yes') where empid= '" & Me.txtEmpId.Value & "' and testid= '" & Me.txtAutoNumber.Value & "'") ...

VBA update query

Below query is resulting zero rows updated but i am sure that there is a record to update DoCmd.RunSQL (" Update tbltesting set IsDiff ='Yes' " & _ "where empid= " & Me.txtEmpId.Value & _ " and testid= " & Me.txtAutoNumber.Value & ";") Please help!! ...

Visual Basic dot operator syntax--no object name

In a former life I wrote some Visual Basic, and today I need to resurrect those skills to write an Excel Macro. While trawling the Internet looking for VBA examples to help we with this Excel macro, I came across this unusual syntax: Set rFound = .Columns(1).Find(What:="Cat", After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _ xlP...

How to test if a font is installed using VBA?

What is the easiest way to check if a particular font is installed using VBA? ...

VBA select not returning any rows

Below query is not returning any rows into the listbox.There is no error message: lstDiff.RowSource = "select TestScenario,TestId from tblTesting where empid= '" & Me.txtEmpId.Value & "' and testid= '" & Me.txtAutoNumber.Value & "'" Could anyone help? ...

Adding external attachment an mailing from Access

Hi, I am trying to send e-mail from MS Access using VBA but cannot use the sendobject function as this doesn't support external file attachment. Does anyone know how I can do this? Thanks ...

PowerPoint 2003 - VBA for entering information into the Notes section?

I am trying to find out how you write VBA to enter a text box into a slide, and enter text. I am also trying to find vba for entering text into the notes section of a PowerPoint slide. Any help would be greatly appreciated. I have tried to find a site specifically for this, but have not been able to do so ...

MS Access VBA Listbox with row colouring?

Hi there, I'm trying to put together a little list box, populated from a query, that would have the background colour of its rows as different colours depending on a certain status. I've done some googling around the subject and it doesn't seem possible using the standard controls that the Access form designer provides. There are some A...