vba

Using VBA for word to select text and make it bold

好久不见. 提交于 2021-02-07 09:39:36
问题 I make a several page word document every week. I copy text from a PDF and paste it into a word document, I then format the text that I pasted. This takes a long time and i would like to automate it. I need a macro or some code to select specific text, then make that text bold. The specific text i need to bold is what i call a scrap code. There are 60 different codes. For example "FIPS", or "LILL". 回答1: Something like this: Sub A() ' ' a Macro ' ' Dim A(3) As String A(1) = "code1" A(2) =

Using VBA for word to select text and make it bold

冷暖自知 提交于 2021-02-07 09:39:31
问题 I make a several page word document every week. I copy text from a PDF and paste it into a word document, I then format the text that I pasted. This takes a long time and i would like to automate it. I need a macro or some code to select specific text, then make that text bold. The specific text i need to bold is what i call a scrap code. There are 60 different codes. For example "FIPS", or "LILL". 回答1: Something like this: Sub A() ' ' a Macro ' ' Dim A(3) As String A(1) = "code1" A(2) =

Error Handling in C# / VBA COM Interop

六眼飞鱼酱① 提交于 2021-02-07 09:34:48
问题 I have a C# DLL being called from Excel VBA which I have exposed via a COM Callable Wrapper / COM Interop. I want to be able to pass any exceptions which occur in the C# code up onto the VBA client. Are there any recommended approaches to doing this ? Thanks. 回答1: It is possible to create your own exceptions that communicate HRESULT error codes back to VBA or other COM based callers. Here's an example that uses E_FAIL: public class ComMessageException : Exception { public ComMessageException

Attach multiple files to Outlook email from a filtered list and loop [closed]

别来无恙 提交于 2021-02-07 09:33:46
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question I have a list of customers with their invoice data (one customer may have one or more than one rows of data). I have assembled a macro script from multiple codes to filter out the customer (basis on email address) and send them a dunning letter with their account statement. The

Attach multiple files to Outlook email from a filtered list and loop [closed]

£可爱£侵袭症+ 提交于 2021-02-07 09:33:21
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question I have a list of customers with their invoice data (one customer may have one or more than one rows of data). I have assembled a macro script from multiple codes to filter out the customer (basis on email address) and send them a dunning letter with their account statement. The

Save file as PDF/A using Office.Interop.Excel

二次信任 提交于 2021-02-07 09:20:40
问题 How can I export an Excel spreadsheet to PDF/ A (ISO 19005-1)? EDIT: I'm asking for PDF/A, and not plain old PDF 1.5 as it exports by default. I've even emphasized the A in my original question. I can already export Word and PowerPoint documents to PDF/A, using the ExportAsFixedFormat() function, since the Word and PowerPoint functions both have an optional UseISO19005_1 parameter, but the Excel version is very different, and is missing lots of parameters. I can't seem to find any way to

Save file as PDF/A using Office.Interop.Excel

淺唱寂寞╮ 提交于 2021-02-07 09:20:31
问题 How can I export an Excel spreadsheet to PDF/ A (ISO 19005-1)? EDIT: I'm asking for PDF/A, and not plain old PDF 1.5 as it exports by default. I've even emphasized the A in my original question. I can already export Word and PowerPoint documents to PDF/A, using the ExportAsFixedFormat() function, since the Word and PowerPoint functions both have an optional UseISO19005_1 parameter, but the Excel version is very different, and is missing lots of parameters. I can't seem to find any way to

Workbooks.OpenText ignoring FieldInfo column parameter

元气小坏坏 提交于 2021-02-07 09:19:21
问题 I have the below line to import a csv format file. Workbooks.OpenText Filename:=sPath, DataType:=xlDelimited, Comma:=True, FieldInfo:=Array(Array(18, 5), Array(19, 5)), Local:=True From microsoft's documentation here, the FieldInfo doesn't have to be in any order if it is in delimited. The column specifiers can be in any order. If there's no column specifier for a particular column in the input data, the column is parsed with the General setting. However excel seems to treat the first array

Workbooks.OpenText ignoring FieldInfo column parameter

时间秒杀一切 提交于 2021-02-07 09:17:01
问题 I have the below line to import a csv format file. Workbooks.OpenText Filename:=sPath, DataType:=xlDelimited, Comma:=True, FieldInfo:=Array(Array(18, 5), Array(19, 5)), Local:=True From microsoft's documentation here, the FieldInfo doesn't have to be in any order if it is in delimited. The column specifiers can be in any order. If there's no column specifier for a particular column in the input data, the column is parsed with the General setting. However excel seems to treat the first array

Access .NET generic objects from VBA

血红的双手。 提交于 2021-02-07 09:16:28
问题 My .net code has an object with a number of generic properties. This object is returned to the VBA code. All the non-generic properties are working well, but I also need to access the generic values. Is there a way to do it from VBA? [ClassInterface(ClassInterfaceType.AutoDual)] public class Obj { public string GetProp1() {...} public IList<MyCustomType> GetProp2() {...} } VB code: Sub Test() Dim o As Program.Obj Set o = New Program.Obj Set p2 = hp.GetProp2() set p2_0 = p2(0) ' doesn't work