vba

VBA Word Expand Range with one line

随声附和 提交于 2021-02-11 18:21:11
问题 First of all this is the first time I am creating a macro using VBA code. With some bits and pieces i found on the internet I tried to create the following. I am not a developer at all, I just have some basic knowledge from school. So my apologies if this is poor coding. I am creating a macro in word which highlights text from a paragraph heading until the next heading with the same style. This is done based on a list of headings I import from Excel. You can find the code I have created below

How to change encoding from UTF-8 to UTF-8-BOM of exported *.txt files from Excel?

落花浮王杯 提交于 2021-02-11 18:19:39
问题 Exported text files from Excel are encoded with UTF-8. An encoding UTF-8-BOM is needed. I think that in code shall be inserted a row, written like: Java ?xml version="1.0" encoding="UTF-8"? Jasperreport CSV UTF-8 without BOM instead of UTF-8 or HTML5 meta charset="utf-8" Bad UTF-8 without BOM encoding Sub export_data() Dim row, column, i, j As Integer Dim fullPath, myFile As String fullPath = "C:\Workspace" row = 21 column = 5 For i = 1 To column myFile = Cells(1, i).Value + ".txt" myFile =

Adding watermark to a Access report page

时光毁灭记忆、已成空白 提交于 2021-02-11 18:17:16
问题 I am trying to add a watermark to an Access report using the "Picture" property and have run into an issue. The following code works and the image is displayed/printed when the report is previewed and printed but does not work when the report is directly printed from a macro (nothing visible on-screen). "GrandTotal" is a bound text box on the report that is the sum of a field in the record source. I would appreciate any suggestion to print the watermark from both the print preview and the

64 bit Excel VBA to call a JavaScript function

Deadly 提交于 2021-02-11 18:16:43
问题 I need to use a VBA ScriptControl object to call a JavaScript function , but it gave me a "Class Not Registered" error. I have added Microsoft Script Control 1.0 from Tools->References I need to call JavaScript to get a JSON object from this Rest API to calculate values in an Excel Macro. This post told me that ScriptControl is for use in 32 bit only. I am using 64 bit Excel. I also tried using the method mentioned in this link but it didn't work since VBA doesn't recognise the ActiveXObject

Adding watermark to a Access report page

冷暖自知 提交于 2021-02-11 18:13:02
问题 I am trying to add a watermark to an Access report using the "Picture" property and have run into an issue. The following code works and the image is displayed/printed when the report is previewed and printed but does not work when the report is directly printed from a macro (nothing visible on-screen). "GrandTotal" is a bound text box on the report that is the sum of a field in the record source. I would appreciate any suggestion to print the watermark from both the print preview and the

Adding watermark to a Access report page

不羁岁月 提交于 2021-02-11 18:09:12
问题 I am trying to add a watermark to an Access report using the "Picture" property and have run into an issue. The following code works and the image is displayed/printed when the report is previewed and printed but does not work when the report is directly printed from a macro (nothing visible on-screen). "GrandTotal" is a bound text box on the report that is the sum of a field in the record source. I would appreciate any suggestion to print the watermark from both the print preview and the

Adding watermark to a Access report page

僤鯓⒐⒋嵵緔 提交于 2021-02-11 18:08:55
问题 I am trying to add a watermark to an Access report using the "Picture" property and have run into an issue. The following code works and the image is displayed/printed when the report is previewed and printed but does not work when the report is directly printed from a macro (nothing visible on-screen). "GrandTotal" is a bound text box on the report that is the sum of a field in the record source. I would appreciate any suggestion to print the watermark from both the print preview and the

Submitting form and reading results using Excel VBA and InternetExplorer

家住魔仙堡 提交于 2021-02-11 17:52:49
问题 I'm submitting a form using Excel VBA while using an InternetExplorer object. Once submitted, I can see the URL change on screen. However, when I attempt to output the URL (to confirm that it changed and the code knows it), I get the same URL. In both debug statements below, they output the same URL. Code: Dim username As String Dim password As String Dim server_ip As String username = "aaa" password = "bbb" server_ip = "ip_here" Dim ie As New InternetExplorer Dim doc As HTMLDocument Set doc

How to format Sunburst chart in VBA?

≯℡__Kan透↙ 提交于 2021-02-11 17:50:58
问题 I am desperately trying to format a sunburst chart via VBA. According to the number of Points I want the columns to use one of my colors from green to red. The data on which the charts builds upon is specified on another sheet, so I'm formatting the chart once the chart sheet gets activated. Private Sub Workbook_SheetActivate(ByVal Sh As Object) 'Only when correct sheet is opened If Not Sh.Name = "Radar Chart" Then Exit Sub 'Do things to find out which data point number is at the core of each

VBA Word - filling out multiple forms with pop-up window

六眼飞鱼酱① 提交于 2021-02-11 17:45:25
问题 My task: I have multiple forms in one Word document and it has to be filled out with the same information such as company name, address, tax number, etc. My experience with VBA is very limited so I used bookmarks and wrote some code: Private Sub OKbutton_Click() Dim FirmaName As Range Set FirmaName = ActiveDocument.Bookmarks("FirmaName").Range FirmaName.Text = Me.TextBox1.Value Dim FirmaNameRio As Range Set FirmaNameRio = ActiveDocument.Bookmarks("FirmaNameRio").Range FirmaNameRio.Text = Me