vba

Help me converting this code from Java to VBA

Hi, I need a to create a VBA function that extract a text from a string I wrote this java method public static String extract(String str) { String s = str.substring(str.indexOf("'"),str.lastIndexOf("'")); String fg = s.substring(s.indexOf("'")+1, s.indexOf("to")-2); String sg = s.substring(s.indexOf("to")+4); return s...

vba collection of shapes

Hi, I want to store buttons in some sort of collection, arraylist, so that I can add and remove dynamically. I tried to use Collection but seems it is not the choice, as I got an error when ar.Add() is reached. Object doesn't support this property or method. Public Sub removeAllFormsWithAdd() Dim myshape As Shape Dim ar As Coll...

Getting the unicode value of a char in VB

How can I get the unicode value of a char? For example, I know that I can do this with ascii: i = Asc("a") // i == 97 (correct) What if I have a unicode char though? i = Asc("•") // i == 149 (incorrect... should return 8226) Obviously the second example doesn't work since that character is not in the Ascii set. Is there an equival...

Get Normal Font Style in PowerPoint

I'm trying to check a presentation for the fonts that exist in it. This can be done with ActivePresentation.Fonts. I also want to check if the font is normal, bold and/or italic. Bold and Italic are easy, but Normal is not. For example, say I have two text boxes, one of them has "Hello World" in Arial Italic and another the same in Arial...

How to activate a specific worksheet in Excel

I just need to activate a certain worksheet. I have a string variable that keeps the name of the worksheet. ...

Copy filtered data to new Excel workbook and prompt with Save As dialog

I have a worksheet which contains some financial data to be transferred to accounting system. Can say I know some things about programming, but Excel macros are little too much for me, so please suggest some (even partial) solutions to my problem. Thanks! Master workbook columns are: Name Account Date Followup Amount Checked Transfer...

Syantax error in SQL statement in VBA of MS Access

I wrote code: str = "INSERT INTO prod_LJ_Completion VALUES (" _ & 0 & ", " & PartID & ", " & cmbLJ_TypeID.value & ", " & isChk(chkLJ_Transformator.value) & ", " _ & isChk(chkLJ_LAD.value) & ", " & txtLJ_KevlarCable.value & ", " & txtLJ_GrayCable.value & ", " _ & txtLJ_WhiteCable.value & ", " & cmbLJ_CylinderTypeID.value & ",...

Change Power Point layout in VBA

Hi all, I'm doing some VBA work. In VBA, there are Application, Presentaion, Slide, Window objects. Their corresponding documents are poorly constructed so I'm confused how can I organize all my show into a templated manner, in which, original presentation slides are placed in the center with margin on four sides and have a short descri...

Excel VBA puts extra blank line at end of text file when exporting

I have an Excel VBA macro that outputs to a text file. There is always a blank row at the bottom of the text file and I am having trouble getting rid of it. Any useful suggestions would be greatly appreciated! Thanks Here is a sample text file generated from this code: link. You would probably have to download it and open it in notepad ...

Referencing a .NET 3.5 created DLL in VBA (Access)

I have created a small class library using .net 3.5 which builds a DLL that I want to use in an Access 2003 database. I have checked the Register for COM interop in the Compile options. Once the Build is done, there is dll and tlb file created. I now reference the TLB file in my access database and it works with no issues when it is ...

Pulling dynamic data from Sheet2 into Sheet1 then to Sheet3..10

So I have Sheet1 and Sheet2, Sheet1 is user set settings and Sheet2 is a table of values generated by different values in Sheet1. Now Sheet3..10 can be created, which will pull a value from Sheet2 based on calculations on it. The problem I'm running in to is when say Sheet3!H20 is updated from Sheet2!I15, how do I get Sheet3!H20 to have...

How to get started with Visual Basic for Applications?

Hello Everybody, I'm a little intimidated by the wealth of knowledge displayed on the front page of this website, but it gives me hope that I'm talking to the right people. I had a pretty rotten experience with one of our programmers today, and I'm hoping that you might be able to offer some advice. I'm an office admin (primarily cler...

Forcing the unloading forms from memory

I am writing a solution in Excel that uses a number of linked data entry forms. To move between he sequence of forms, the user can click a "Previous" or "Next button. The current form is unloaded and the new one loaded and opened. Sub NextForm(curForm As MSForms.UserForm, strFormName As String) Dim intCurPos As Integer ...

How do I make an integer to null in Excel VBA?

I am trying to detect whether an integer was set, and if not, skip most of the code in the loop (using an if statement). Here is what I have so for. Do While hws.Cells(r, 9).Value <> "" On Error Resume Next ar = Null ar = aws.Range("A:A").Find(hws.Cells(r, 2).Value).Row If Not IsNull(ar) Then 'work with ar' End If ...

Capture Access-Application Window Restore/Maximize Event

Scenario: In an Access project a main form has to be positioned and rearranged depending on the size of the Access-Application window. This should be done using VBA. As far as I know there is no way in Microsoft Access VBA to capture the Restore/Maximize-Event of the Access-Application window (I refer to the Access Window itself not any...

Inserting symbols into text in PowerPoint 2007 using VBA

I need to append programmatically (VBA/VSTO) several special symbols (e.g., smileys) into text in a TextRange in PowerPoint 2007. I can insert a symbol using: With ActiveWindow.Selection.TextRange .Text = "sometext" Call .Characters(.Characters.Count + 1).InsertSymbol("Arial", 65, MsoTriState.msoTrue) End With Unfortunately, w...

Getting mixed tabular & non-tabular data from Excel into Access

My Access programming is a little rusty, & I've never worked with Excel files all that much. I have a requirement to bring data from Excel spreadsheets into Access 2007. These spreadsheets have a fixed (predictable) format, but it includes a "header area" where I need to read single data items from specific cells, followed by a mass of ...

How to script Excel or Numbers on a mac, and launch from bash?

Hi, I want to write a bash script for a mac which takes a text file containing a table of numbers (can be .csv), converts the numbers to a chart, saves the chart (any file format that I can display on my web page), and exits. It must do this unattended. No user interaction. I know bash, perl, and a little AppleScript, and I can learn...

vba loop through cell edges for border

Basically, I want to loop through the edges in the Borders collection. is there any "for each" way to do this? Private Function getCellBorder(ByVal vArg As Range) As String For Each Edge in Borders Debug.Print vArg.Borders(Edge).LineStyle Next Edge End Function ...

outlook 2007: adding new employees automatically/programmatically?

we have about 300 employees and we are hiring like crazy. is it possible to programmatically add new contacts to every employees' address books as new hires come in? ...