Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [vba]

Visual Basic for Applications; a subset of Visual Basic used in all Microsoft Office applications. Consider using this tag together with the tag for the specific application in question. Good questions on VBA generally contain some code and asks for solution of specific issues. Questions asking for entire solutions (please give me the code / how to do this and this with VBA) are off topic and will be closed as too broad.

3
votes
0answers
896 views

Have a different style set in different sections of the same Word document

I have a document "template" (not yet a template file type - I hope to create that as described below) for a report. The report is broken up into different sections: Letter to the Client Table of ...
3
votes
0answers
676 views

How do I get an event to fire when the slide changes in PowerPoint?

I already know of two supposed fixes, which I will list below, along with the reason they don't work for me. The first is to use the SlideShowNextSlide subroutine. The problem with this is that it ...
2
votes
0answers
19 views

Outlook run VBA script on email to move to folder based on 6-digit number in subject

Our company uses a 6-digit number for our projects. I'm attempting to create a script that will search the email subject for this 6-digit number, then find the subfolder that starts with this 6-digit ...
2
votes
0answers
50 views

How to fix error in VBA code

I am trying to email the sheet within workbook, sometimes the code works but sometimes returns an errors. This line kicks error is,: If Dir(FileCell.Value) <> "" Then Error says: Run-time ...
2
votes
0answers
142 views

Updating List in Sharepoint Online (o365) via Excel/VBA

I am currently using VBA to update/create new sharepoint list items via SOAP. My IT dept has advised that they are migrating to SharePoint Online and the same code no longer works, I believe due to ...
2
votes
0answers
61 views

Limit available printers for a MS Word Document, or define a “Default printer” in a particular document

I've a lot of printers (or specific printer's queue with particular setup for each queue) configured on my PC. Each have a unique "Printer Queue Name". I work with a software which generates Word ...
2
votes
0answers
167 views

Newly opened Excel not counted on Workbooks.Count

I have a VBA macro that waits for another application to generate a new Workbook, however, as I run Workbooks.Count it doesn't count the newly generated file. It seems that the new Workbook opens on ...
2
votes
0answers
726 views

Keyboard Shortcut to Toggle Between Modules in Excel VBA Editor

I am working with multiple modules in Excel's Visual Basic editor. Is there a shortcut to toggle between different modules?
2
votes
0answers
34 views

How can I set Microsoft Word up to change any text encapsulated in `backticks` to monospace?

I wish to be able to type `simple code` in between backticks as shown, and have Word automatically change the font to some monospace variant. I am aware of alternatives such as LaTeX, but would like ...
2
votes
0answers
76 views

Copy hyperlinks from original list to search index list

I've created a search index (using formulas) from a list of products that have hyperlinks attached (created with Insert Hyperlink). The search index is created without the hyperlinks however. Both ...
2
votes
0answers
918 views

Excel does not update formulas values after filling source cells with values

I do 3 steps: Based on a template, I create a new Excel file through code (it works fine): Shared Sub FillExcel() Dim extension As String = ".xlsx" Dim sourcePath As String = "c:\Temp\libro" & ...
2
votes
0answers
870 views

How can I sign an MS Word macro with a digital certificate from the local machine certificate store?

I am trying to find out how I can digitally sign a Microsoft Word macro using a valid 3rd party CA issued VBA code-signing certificate that is installed into the machine rather than the user ...
2
votes
0answers
81 views

VBA substitute for Microsoft Office RT?

I've been working on VBA-based applications for automating Excel and other MS Office applications. Now I'd like to expand to MS Office RT, but I've read that Office RT has no VBA support. Is there any ...
2
votes
0answers
743 views

Moving emails with specific number in subject to a specific folder with the corresponding number

I get emails in shared inbox containing a number in the subject (like 9921635). These emails are archived to subfolders, which are part of the shared inbox, that also contain this number. Sometimes ...
2
votes
0answers
1k views

Outlook VBA script - find and replace text with image

I have a e-commerce store. When I get a sale, I receive an order confirmation email which contains the name of the product sold. When the email comes through, I would like to run a script that ...
2
votes
0answers
671 views

How can I create a Search folder that contains multiple object types in Outlook 2007 from a secondary mailbox?

I added an additional mailbox to my account. I want to create a view that is similar to the 'to do list' view that exists for that user. This means I want a search folder that searches that mailbox ...
1
vote
0answers
9 views

Want rows to hide/unhide automatically as cell changes without having to run the vba everytime

I don't want to have to press "Alt F8" to hide 0 value rows and unhind rows >0 I want it to Do it Automatically as the data changes. This is the VBA code that works to hide/unhide rows with a value ...
1
vote
0answers
18 views

BeforeDoubleClick on Protected Cell

I wrote some code that manipulates the target cell when it is double-clicked by the user. The code works fine for most cells on the worksheet. But the worksheet is protected (only unlocked cells ...
1
vote
0answers
59 views

How do I create a dynamic range using calculated cell references?

I'm struggling since I'm not the best with working out the most efficient way to do these things. Check the following: "First row with data: 10". Calculated by a formula that looks for the first ...
1
vote
0answers
16 views

Excel filter vanishes after change in sheet

I have a excel-file with multiple sheets. Sheet1 (Lagerliste) holds a bunch of logistics-data. Mainly: WHAT is WHERE In a seperate sheet I want to filter all lines containing a certain value (...
1
vote
0answers
13 views

VBA to check which stylesheet is loaded in Word

I have a small macro to change styles automatically, but it won't work unless the right style sheet is selected. At the moment, it looks like this: ActiveDocument.ApplyQuickStyleSet2 ("Anthology") '...
1
vote
0answers
14 views

Separate old files with date information stored in excel

I have approximately 2000 files, of which I need to separate any files before a specific date (say, 2015). These are currently separated into subfolders for each categories of file (Say, projecttype1,...
1
vote
0answers
55 views

Msgbox VBA on closed workbook

I have 2 different workbooks: workbook-1 workbook-2 I want msgbox in workbook-1 referring to values in workbook-2. For example: In workbook-1: | A | | B | | C | In workbook-2: | A | 10 | 5 | 6 ...
1
vote
0answers
32 views

Making a cell Mandatory based on conditional formatting of another cell

I am looking to achieve the following: Column C has been conditionally formatted based on data entry: if the entered data is out of range, cell background will turn red. I want to force a data entry ...
1
vote
0answers
111 views

Can the name of a range be dynamic with multiple sheets in Microsoft Excel

I am a newbie on VBA. What I would like to know is can the name of a range be dynamic with multiple sheets. I have searched online and came across a similar question asked by someone else and was ...
1
vote
0answers
272 views

Prevent losing a digital Signature when a document is saved?

The question What is an effective work-around to prevent a Digital Signature dropping from a file when it's saved? Or, What would be an efficient way to replicate saving data to a Macro Enabled MS ...
1
vote
0answers
85 views

Why does word macro behaviour change when used in conjunction with track changes?

A recent issue I noticed when running word macros (in this case specifically search and replace operations), is that they don't have the expected behaviour when track changes is activated (it makes ...
1
vote
0answers
288 views

oAuth 1.0 - getting request token with VBA

I tried VBA-Web for Upwork API authentication. Unfortunately I'm new to oAuth and the examples on how to use VBA-Web authentication are based on classes designed for APIs with quite different ...
1
vote
0answers
185 views

Excel : How to restrict maximum number of users to an shared excel file in our organisation's server

I have shared excel workbook on my organisational file server. I created this for online attendance system for my org. We have around 20 sections. One tab (excel sheet) is dedicated to each section ...
1
vote
0answers
45 views

In Excel, calculate sum of a column where multiple cells contain specific text

I have a large dataset I'm working with consisting of many records that represent lines on a map. The order heirarchy is State -> County -> Line # -> Line Class -> Line Length. There are multiple ...
1
vote
0answers
477 views

VBA error: -2147188160 when PasteSpecial a Shape

I've a vba procedure that call another procedure (addChart(cht, PptApp, oPres)), to add charts to a powerpoint presentation. When I run the full code, the procedure create a new ppt and paste the ...
1
vote
0answers
316 views

Change font of selection in PowerPoint

I am trying to create a very small macro to change the format (text size and font) in Powerpoint. I have tried using this code taken from a similar question on StackOverflow. The code works, just ...
1
vote
0answers
81 views

Microsoft Publisher 2016 Lacks [x of y] page numbering - How to achieve this?

Simply put, our office has been using MS Word for their training documentation. As I began inserting a large number of photos, this caused Word's formatting to break in the most frustrating ways ...
1
vote
0answers
41 views

Microsoft VBA Editor: assign other keyboard shortcuts

The Microsoft VBA Editor (for Excel, Word, etc.) has a number of keyboard shortcuts for certain frequent actions, e.g. "F8" for "Step into a procedure for step by step debugging". I want to assign ...
1
vote
0answers
14 views

Word 2010 - Coversheets

We have created standard coversheets for several projects. These coversheets are exchanged on standard documents to make it client specific. The font type of these coversheets is Arial. It seems that ...
1
vote
0answers
23 views

Is this a range and if yes, how would I access it?

In my word document I have 2 "sections". This is a screenshot: Unfortunately I can't access the "section" on the right side using this code: Dim rng As Range Dim rngText As Range Set rng = ...
1
vote
0answers
28 views

VBA and Access, trying to Combine two types of outputs, both from the same field, and display the associated sums under one newly created type

I'm pretty new to programming in VBA and using Access in general. I'm trying to design queries for an industry survey, where I need to display sales sums for each of our various distribution channels....
1
vote
0answers
160 views

MS Excel 2016 crashing when inserting UserForm

I had previously installed MS Office 2007 and recently I additionally installed MS Office 2016. When I tried to add a UserForm in an empty Workbook, the Excel crashed without any explanation. When I ...
1
vote
0answers
203 views

How to create a rule or VBA code for Outlook to copy the the messages from specific folder to another folder?

I am looking solution to the following problem: There is a mailbox for the requests from the customers with 7 clients that filtering the incoming e-mail from general "Inbox" to the different folders ...
1
vote
0answers
665 views

How do I set up Outlook to send an auto reply during night time?

I am using Microsoft Outlook 2016 Home. I have international customers who expect a rapid response to the emails they send me. In order to get some sleep, I would like to set up an "Out of Office" ...
1
vote
0answers
44 views

Application/object error during paste special operation

I have been working in this code for a week now, I'm kind of new to VBA and am close to getting it to do what I need it to but I keep getting a "Aplication-defined or object-defined error" on the last ...
1
vote
0answers
334 views

Open URL, Take Print Screen and Paste into Cell

I am trying to launch a URL, and then screen capture the IE window that opens (when the URL is launched it also starts a SmartCard Reader application), so I need it to either capture all windows open ...
1
vote
0answers
126 views

Check if an email item in a shared mailbox is opened by another user

I am developing an Access (2016) multi-user application to access several shared mailboxes in order to move a batch of emails to a local folder for 'manual' processing by each user. The procedure ...
1
vote
0answers
222 views

Create dynamic graph in Excel via VBA

I'm trying to create a graph, manually or with VBA, which will automatically update when new sheets are added. Data is imported from an external table monthly, and each time is added to a new sheet. ...
1
vote
0answers
374 views

VBA using an array to avoid hard coding values to call different macros

I have values in column D of a sheet (Sheet2) in a workbook thats values are derived from a formula to get just the final part of longer values in column C cells. The longer values are automatically ...
1
vote
0answers
106 views

VBA unable to fully clear sheet after being called by dropdown + Workbook_SheetChange

I have a central summary sheet which is automatically generated using VBA with data from other various other sheets. When the data on other sheets is changed, VBA automatically (using ...
1
vote
0answers
304 views

What is going on in the IE cache at runtime

I am writing a script in Excel VBA to get the thumbnails off a google images search. When trying to figure out how to clean up the temporary files made in this automated search, I stumbled upon the ...
1
vote
0answers
53 views

Vlookup Assistance

I have a project where I need to lookup up/match multiple values from Column B to match a criteria selected from a drop down list in Column A. The project pertains to different countries and their ...
1
vote
0answers
965 views

Cannot upload file to FTP from Excel's VBA

I need to automate uploading file to FTP server from within Excel's macro. I'm following a simple path of creating script file and then running FTP.exe with commands from that script file. The ...
1
vote
0answers
663 views

HTTP redirect request failed error using WinHttpRequest in Excel

I created an excel script to download Historic prices from international stocks in a text file, the script used to work fine till last Monday, now everytime that I call this segment of the code ...