打扰一下,如果我问的是已经处理过的问题。 我正在尝试自动化我们公司的发票。 我们有一个excel工作簿,其中包含有关客户,每月付款等的所有信息。我已经制作了系统并且工作得很好。我甚至发送了带有特定文本和附件发票的电子邮件。 当多个用户使用系统时出现问题,因此发票号码重复。 发票编号存储在Excel工作簿中,在每张发票后,它变为+ 1。
系统的工作原理如下: 登录表单 - 使用用户名登录。 宏表副本来自主表/已修改受保护/仅用户客户端的信息并将其粘贴到新的wb模板中。用户检查信息,批准信息并单击发送按钮。 然后宏使用第一个wb中的数字制作发票并将电子邮件发送到客户端。 当有人使用宏时,您是否有任何提示如何保护发票号码单元?我正在考虑制作一个用户列表,当有人登录他的变量变为1时,如果所有用户的总和大于1,你就无法开具发票。但那是蹩脚的。 希望有一种方式 - 忙的时候...... 但是用户2如何知道user1正在发布。 如果你能提供帮助,请欣赏。
答案 0 :(得分:0)
我不是完全清楚你在这里使用的确切过程来获取发票号码,但听起来这个号码正在从另一张表中检索,然后加一,正确?
如果是这样,最好的选择可能是随时记录每张发票 - 一旦宏抓取发票号,它就会记录一个新的数据行,上面有新的发票号。这样下一个使用宏的人,即使只是几秒钟之后,也会获得序列中的下一个数字,而不是相同的数字。这个过程就像是:
In file included from codegen.cpp:2:
In file included from ./codegen.h:8:
In file included from /usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:46:
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:298:12: error: use of undeclared identifier 'make_unique'
return make_unique<ResultModelT>(Pass.run(IR, AM));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:298:24: error: unexpected type name 'ResultModelT': expected expression
return make_unique<ResultModelT>(Pass.run(IR, AM));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:336:12: error: use of undeclared identifier 'make_unique'
return make_unique<ResultModelT>(Pass.run(IR));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:336:24: error: unexpected type name 'ResultModelT': expected expression
return make_unique<ResultModelT>(Pass.run(IR));
^
codegen.cpp:36:24: error: no matching conversion for functional-style cast from 'unique_ptr<llvm::Module>' to 'llvm::EngineBuilder'
ExecutionEngine *ee = EngineBuilder( unique_ptr<Module>(module) ).create();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/anaconda/include/llvm/ExecutionEngine/ExecutionEngine.h:493:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion
from 'unique_ptr<llvm::Module>' to 'llvm::EngineBuilder' for 1st argument
class EngineBuilder {
^
/anaconda/include/llvm/ExecutionEngine/ExecutionEngine.h:493:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion
from 'unique_ptr<llvm::Module>' to 'const llvm::EngineBuilder' for 1st argument
/anaconda/include/llvm/ExecutionEngine/ExecutionEngine.h:525:3: note: candidate constructor not viable: no known conversion from 'unique_ptr<llvm::Module>'
to 'llvm::Module *' for 1st argument
EngineBuilder(Module *m) : M(m) {
^
codegen.cpp:131:49: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid'
[-Wpotentially-evaluated-expression]
std::cout << "Generating code for " << typeid(**it).name() << endl;
^
In file included from codegen.cpp:2:
In file included from ./codegen.h:8:
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:207:22: error: no member named 'getName' in 'llvm::Module'
<< IR.getName() << "\n";
~~ ^
codegen.cpp:30:5: note: in instantiation of member function 'llvm::PassManager<llvm::Module>::run' requested here
pm.run(*module);
^
In file included from codegen.cpp:2:
In file included from ./codegen.h:8:
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:517:20: error: no member named 'getName' in 'llvm::Module'
<< IR.getName() << "\n";
~~ ^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:372:28: note: in instantiation of member function
'llvm::AnalysisManager<llvm::Module>::invalidateImpl' requested here
return derived_this()->invalidateImpl(IR, std::move(PA));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:217:22: note: in instantiation of member function
'llvm::detail::AnalysisManagerBase<llvm::AnalysisManager<llvm::Module>, llvm::Module>::invalidate' requested here
PassPA = AM->invalidate(IR, std::move(PassPA));
^
codegen.cpp:30:5: note: in instantiation of member function 'llvm::PassManager<llvm::Module>::run' requested here
pm.run(*module);
^
我想你无论如何都想要保留所有发票的清单 - 只需在录制过程中包含这一步骤。
答案 1 :(得分:0)
所以我将接受Ralph的建议,我期待着学习一些Access数据库的东西。祝你一切顺利!
P.S。和vba一起工作一两个月,所以我很喜欢新手。谢谢你的理解。