vba

Changing Positions of the Chart When Creating Multiple Charts Automatically via Vbasic in Excel 2007

I am creating a new chart for each row of data in an Excel spreadsheet. I have the Vbasic working properly, but I want to change the position of the chart on the sheet that is added for each row. Below is my code, what do I need to do to change the position of the chart on the page automatically? Ideally, I would like it to be in th...

What is the best way to learn VB/VBA?

I have wanted to learn VB and VBA for a long time. My school offers a coarse, but it doesn't fit with the rest of my schedule. It will be my first programing language. I was considering using the textbook my school uses (An introduction to programing using visual basic 2008, but I wold get the 2010 version), but I was wondering if there ...

selecting among duplicated rows in VBA _updated

I wanna select one row of each duplicated SIDs in a field below. (an attribute table of a shape file) The priority is R > S = I > 0 Therefore, among SID 87, FID1 will be selected. (SID 88, STATUS will be S+I) (SID 89, FID 6 will be chosen) (SID 90, deleting FID 9 or 10) Please kindly advise VBA code to implement the sel...

Cell (SubItem) editing in ListView using VBA

Hi, How to implement cell editing for ListView SubItems in VBA? I would like to use ListView as an editable Grid on a VBA UserForm. ...

Open an Access database and run one of its Macros from Excel

From Excel, I need to open an Access database and run one of the database's macros. I'm using Excel and Access 2007. Here is my code in Excel: Sub accessMacro() Dim appAccess As New Access.Application Set appAccess = Access.Application appAccess.OpenCurrentDatabase "C:\blah.mdb" appAccess.Visible = True appAccess.D...

VBA Easier To Implement, ODBC vs OLEDB?

To create an ODBC connection in VBA, two things are required: Create a ODBC data source Add references in Excel What I'd like to know is if OLEDB has fewer requirements and is easier to implement. ...

Allow paste in worksheet without overwriting locked cells

I have a protected worksheet that users would like to copy and paste into. I have no control over the workbook they are copying from. The protected worksheet has some rows that are available for data entry, and other rows that are locked and greyed out to the user. The users would like to be able to paste over the top of the entire work...

Conditional formatting in Access

I have a datasheet that looks like this: ID name_ 1 2 3 4 1 name1 x 0 0 0 2 name2 0 x 0 0 3 name3 0 0 x 0 4 name4 0 0 0 x I have rectangles on a report that correspond to this datasheet. When the report opens, I need the rectangles to be colored red according to the data. For example, ...

Duplicate what is in the Textbox in other Textboxes on other sheets

I have four sheets in a spreadsheet. On each sheet there is a textbox. When I type in the textbox on sheet1, I want the textboxes on sheet2, sheet3, and sheet4 to populate with the same value. ...

vba access: each Ctl in report.controls

i need all the rectangles on my form to be red when the report opens. how do i do this? here's my code: Private Sub Report_Load() For Each ctl In fill_boxes.Controls If ctl.Name = acRectangle Then ctl.Name.BackColor = "#ED1C24" End If Next ctl End Sub i get an error OBJECT REQUIRED on t...

Creating An OLEDB Connection From Excel To SQL

I am looking to run SQL queries using VBA code in an Excel file. It may sound like a bad way to do things, but the purpose of this is to support legacy functionality on a project I'm working on. I figured out how to create an ODBC connection, but it requires several steps which may be troublesome to implement on many computers, so I'm...

How to convert a String to a Range Object

Hi, Is there anyway to convert a string value to a Range object ? I'm having a function which takes a Range object as a argument and need to pass a single string parameter to it Thank You ...

VBA: Read file from clipboard

I'm trying to load a file in a VBA macro that has been copied from, say, an Explorer window. I can easily get the data from the clipboard using DataObject::GetFromClipboard, but the VBA interface to DataObject doesn't seem to have methods for working with any other formats than plain text. There are only GetText and SetText methods. I...

vba: what does ReDim Preserve do and simple array question

i am looking at someone else's vba excel code. they are doing ReDim Preserve dataMatrix(7, i) in both loops. what does this do? also, it seems like the second loop just overwrites the data in the first, loop, is that correct? Dim dataMatrix() As String Worksheets.Item("ETS").Select Do While Trim(Cells(r, 1)) <> "" Debug...

VBA snippet to delete outlook messages from a user created folder that are 6 months or older

title says it all ...

vba: on error, force function to return

i have a function that returns a string on error, i would like it to return a specific value. how do i do this? ...

vba Debug.Print question

how do i get Debug.Print to display? i do not see the output ...

I need to rename a file in VBA, but getting "File Not Found" when it's clearly there!

Help! I'm getting a File Not Found error when trying to rename a file w/a variable. The variable is string. I can look at the variable and it's the exact filename that is there, but when I run the code, it says not found! Dim filePath, fileName, absPath, newPath As String filePath = "P:\Automated\" fileName = MySite.GetResult absPath =...

Problem opening a file browser dialog with a VBA macro.

I'm trying to make a macro in VBA for Delmia. That macro need to open a file and I want to use a FileBrowserDialog to found the path of this file. I use this code that I found on a site but it was for an example using Excel. In excel this code work very well. The problem in Delmia is sometimes the dialog box do not appear and sometimes ...

Adding multiple links in VBA

When I try and create both of the files as links within the outlook email, only one of the files shows up as a link. How can I resolve this so both will show up as links. Set omail = CreateItem(olMailItem) With omail .Subject = "Key Report" .BodyFormat = olFormatHTML .HTMLBody = "<a href ='" & fileL & "'>Key Report</a>...