-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExcelAddIns.h
More file actions
73 lines (56 loc) · 2.1 KB
/
ExcelAddIns.h
File metadata and controls
73 lines (56 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "windows.h"
#include "comutil.h"
#include "Oleacc.h"
//MSO.DLL: C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE14\
#import "MSO.DLL" no_function_mapping \
rename( "RGB", "MSORGB" ) \
rename( "DocumentProperties", "MSODocumentProperties" ) \
rename ("FirstChild", "MSOFirstChild") \
rename ("NextSibling", "MSONextSibling") \
#pragma warning( disable : 4146 )
using namespace Office;
//VBE7.DLL: C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA7\
#import "VBE7.DLL" no_function_mapping \
rename( "EOF", "VBAEOF" ) \
rename( "RGB", "VBARGB" ) \
rename( "GetObject", "VBAGetObject" ) \
rename( "DialogBox", "VBADialogBox" )
#include "xVect.h"
#include "WinUtils.h"
using namespace VBA;
//VBE6EXT.OLB C:\Program Files (x86)\Common Files\microsoft shared\VBA\VBA6\
#import "VBE6EXT.OLB" no_function_mapping
#import "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" no_function_mapping \
rename( "DialogBox", "ExcelDialogBox" ) \
rename( "RGB", "ExcelRGB" ) \
rename( "CopyFile", "ExcelCopyFile" ) \
rename( "ReplaceText", "ExcelReplaceText" ) \
rename("FirstChild", "VBAFirstChild") \
rename("NextSibling", "VBANextSibling") \
exclude( "IFont", "IPicture" )
struct RemoveOrAddAddinInfo {
aVect<aVect<wchar_t>> workbooks;
Excel::_ApplicationPtr app;
bool macroHasRun = false;
bool foundAddin = false;
HWND hWnd = NULL;
};
struct ExcelAddInManager {
LogFile * pLogFile = nullptr;
Excel::_ApplicationPtr createdApp;
aVect<RemoveOrAddAddinInfo> openedApps;
aVect<wchar_t> dialogTitle;
bool foundAddin = false;
ExcelAddInManager() = default;
ExcelAddInManager(const ExcelAddInManager&) = delete;
ExcelAddInManager& operator=(const ExcelAddInManager&) = delete;
ExcelAddInManager(ExcelAddInManager&& that) = default;
ExcelAddInManager& operator=(ExcelAddInManager&& that);
~ExcelAddInManager();
void Remove(const wchar_t * name, const wchar_t * VBA_macroToRunOnce = nullptr, HRESULT VBA_macroToRunOnce_okFailure = 0);
void Add(const wchar_t * path, bool install);
};
void ExcelConnection(
const wchar_t * dialogTitle,
ExcelAddInManager & addremove_info,
int& createdProcessID);